Skip to content

Commit

Permalink
avoid NoResultException if 'archive on stop' recording is already del…
Browse files Browse the repository at this point in the history
…eted. may still occur in a race condition, but is harmless - just log noise
  • Loading branch information
andrewazores committed Apr 2, 2024
1 parent 0bc5399 commit a4c0ae8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/io/cryostat/recordings/RecordingHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1101,10 +1101,13 @@ static class StopRecordingJob implements Job {
public void execute(JobExecutionContext ctx) throws JobExecutionException {
var jobDataMap = ctx.getJobDetail().getJobDataMap();
try {
ActiveRecording recording =
Optional<ActiveRecording> recording =
ActiveRecording.find("id", (Long) jobDataMap.get("recordingId"))
.singleResult();
recordingHelper.stopRecording(recording, (Boolean) jobDataMap.get("archive"));
.singleResultOptional();
if (recording.isPresent()) {
recordingHelper.stopRecording(
recording.get(), (Boolean) jobDataMap.get("archive"));
}
} catch (Exception e) {
throw new JobExecutionException(e);
}
Expand Down

0 comments on commit a4c0ae8

Please sign in to comment.