File tree 2 files changed +12
-1
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ private void handleRetryOnException(ExecutionScope executionScope) {
174
174
}
175
175
Optional <Long > nextDelay = execution .nextDelay ();
176
176
177
- nextDelay .ifPresent (
177
+ nextDelay .ifPresentOrElse (
178
178
delay -> {
179
179
log .debug (
180
180
"Scheduling timer event for retry with delay:{} for resource: {}" ,
@@ -183,6 +183,9 @@ private void handleRetryOnException(ExecutionScope executionScope) {
183
183
eventSourceManager
184
184
.getRetryTimerEventSource ()
185
185
.scheduleOnce (executionScope .getCustomResource (), delay );
186
+ },
187
+ () -> {
188
+ log .error ("Exhausted retries for {}" , executionScope );
186
189
});
187
190
}
188
191
Original file line number Diff line number Diff line change 6
6
7
7
import io .fabric8 .kubernetes .api .model .KubernetesResourceList ;
8
8
import io .fabric8 .kubernetes .client .CustomResource ;
9
+ import io .fabric8 .kubernetes .client .KubernetesClientException ;
9
10
import io .fabric8 .kubernetes .client .dsl .MixedOperation ;
10
11
import io .fabric8 .kubernetes .client .dsl .Resource ;
11
12
import io .javaoperatorsdk .operator .api .Context ;
@@ -53,6 +54,13 @@ public void setEventSourceManager(EventSourceManager eventSourceManager) {
53
54
public PostExecutionControl handleExecution (ExecutionScope <R > executionScope ) {
54
55
try {
55
56
return handleDispatch (executionScope );
57
+ } catch (KubernetesClientException e ) {
58
+ log .info (
59
+ "Kubernetes exception {} {} during event processing, {} failed" ,
60
+ e .getCode (),
61
+ e .getMessage (),
62
+ executionScope );
63
+ return PostExecutionControl .exceptionDuringExecution (e );
56
64
} catch (RuntimeException e ) {
57
65
log .error ("Error during event processing {} failed." , executionScope , e );
58
66
return PostExecutionControl .exceptionDuringExecution (e );
You can’t perform that action at this time.
0 commit comments