Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(harvester): ensure empty snapshots are closed #392

Merged
merged 4 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/io/cryostat/agent/harvest/Harvester.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ private Future<Void> uploadOngoing() {

private Future<Void> uploadOngoing(PushType pushType, RecordingSettings settings) {
Recording recording = settings.apply(flightRecorder.takeSnapshot());
if (recording.getSize() < 1) {
return CompletableFuture.failedFuture(
new IllegalStateException("No source recording data"));
}
try {
Path exitPath = Files.createTempFile(null, null);
Files.write(exitPath, new byte[0], StandardOpenOption.TRUNCATE_EXISTING);
recording.dump(exitPath);
if (Files.size(exitPath) < 1) {
return CompletableFuture.failedFuture(
new IllegalStateException("No source recording data"));
}
log.trace("Dumping {}({}) to {}", recording.getName(), recording.getId(), exitPath);
return client.upload(pushType, sownRecording, maxFiles, exitPath)
.thenRun(
Expand Down
Loading