File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
operator-framework/src/main/java/com/github/containersolutions/operator/processing Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,18 @@ void scheduleEvent(CustomResourceEvent event) {
8484 return ;
8585 }
8686 if (eventStore .containsNotScheduledEvent (event .resourceUid ())) {
87+ log .debug ("Replacing event for later processing." +
88+ " New event: {}" , event );
89+ eventStore .addOrReplaceEventAsNotScheduledYet (event );
90+ return ;
91+ }
92+ if (eventStore .containsEventUnderProcessing (event .resourceUid ())) {
8793 log .debug ("Scheduling event for later processing since there is an event under processing for same kind." +
8894 " New event: {}" , event );
8995 eventStore .addOrReplaceEventAsNotScheduledYet (event );
9096 return ;
9197 }
98+
9299 Optional <Long > nextBackOff = event .nextBackOff ();
93100 if (!nextBackOff .isPresent ()) {
94101 log .warn ("Event max retry limit reached. Will be discarded. {}" , event );
Original file line number Diff line number Diff line change @@ -25,9 +25,14 @@ public void addOrReplaceEventAsNotScheduledYet(CustomResourceEvent event) {
2525 eventsNotScheduledYet .put (event .resourceUid (), event );
2626 }
2727
28+ public boolean containsEventUnderProcessing (String uuid ) {
29+ return eventsUnderProcessing .containsKey (uuid );
30+ }
31+
2832 public void addEventUnderProcessing (CustomResourceEvent event ) {
2933 eventsUnderProcessing .put (event .resourceUid (), event );
3034 }
35+
3136 public CustomResourceEvent removeEventUnderProcessing (String uid ) {
3237 return eventsUnderProcessing .remove (uid );
3338 }
You can’t perform that action at this time.
0 commit comments