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 Mar 28, 2024
1 parent f15349d commit 4ef597e
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 4ef597e

Please sign in to comment.