Skip to content

Commit

Permalink
fixup! fixup! ensure recording dumps to exit path
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Oct 3, 2023
1 parent 21f05da commit e3c7d7a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/main/java/io/cryostat/agent/harvest/Harvester.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,33 +219,28 @@ public void recordingStateChanged(Recording recording) {
case STOPPED:
try {
tr.getRecording().dump(exitPaths.get(tr));
uploadRecording(tr).get();
} catch (IOException e) {
log.error("Failed to dump recording to file", e);
} catch (InterruptedException | ExecutionException e) {
log.warn("Could not upload exit dump file", e);
}
if (isSownRecording) {
recording.close();
safeCloseCurrentRecording();
}
// next
break;
case CLOSED:
executor.submit(
() -> {
if (isSownRecording) {
safeCloseCurrentRecording();
}
if (running) {
try {
Path exitPath = exitPaths.remove(tr);
recordings.remove(tr);
uploadRecording(tr).get();
Files.deleteIfExists(exitPath);
log.trace("Deleted temp file {}", exitPath);
} catch (ExecutionException
| InterruptedException
| IOException e) {
log.warn(
"Could not upload exit dump file",
e);
} catch (IOException e) {
log.warn("Could not delete temp file", e);
} finally {
startRecording(false);
}
Expand Down

0 comments on commit e3c7d7a

Please sign in to comment.