1515 */
1616package io .cryostat .reports ;
1717
18+ import java .time .Duration ;
19+
1820import io .cryostat .ConfigProperties ;
1921import io .cryostat .discovery .DiscoveryNode ;
2022import io .cryostat .recordings .ActiveRecording ;
2729import io .quarkus .cache .Cache ;
2830import io .quarkus .cache .CacheName ;
2931import io .quarkus .vertx .ConsumeEvent ;
32+ import io .smallrye .common .annotation .Blocking ;
3033import jakarta .enterprise .context .ApplicationScoped ;
3134import jakarta .inject .Inject ;
3235import jakarta .persistence .PreRemove ;
@@ -54,6 +57,7 @@ class MemoryCachingReportsListener {
5457
5558 @ Inject Logger logger ;
5659
60+ @ Blocking
5761 @ ConsumeEvent (value = ActiveRecordings .ARCHIVED_RECORDING_DELETED )
5862 public void handleArchivedRecordingDeletion (ArchivedRecording recording ) {
5963 logger .tracev ("archived recording cache invalidation: {0}" , recording .name ());
@@ -66,7 +70,7 @@ public void handleArchivedRecordingDeletion(ArchivedRecording recording) {
6670 }
6771 String key = RecordingHelper .archivedRecordingKey (jvmId , recording .name ());
6872 logger .tracev ("Picked up deletion of archived recording: {0}" , key );
69- archivedCache .invalidate (key );
73+ archivedCache .invalidate (key ). await (). atMost ( Duration . ofSeconds ( 5 )) ;
7074 }
7175
7276 @ ConsumeEvent (value = Target .TARGET_JVM_DISCOVERY )
@@ -84,6 +88,7 @@ public void handleTargetDiscovery(TargetDiscovery evt) {
8488 }
8589
8690 @ PreRemove
91+ @ Blocking
8792 @ ConsumeEvent (value = ActiveRecordings .ACTIVE_RECORDING_DELETED )
8893 void handleActiveRecordingDeletion (ActiveRecording recording ) {
8994 logger .tracev (
@@ -96,7 +101,7 @@ void handleActiveRecordingDeletion(ActiveRecording recording) {
96101 logger .tracev (
97102 "Picked up deletion of active recording: {0} / {1} ({2})" ,
98103 recording .target .alias , recording .name , key );
99- activeCache .invalidate (key );
104+ activeCache .invalidate (key ). await (). atMost ( Duration . ofSeconds ( 5 )) ;
100105 }
101106
102107 @ PreRemove
0 commit comments