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 @@ -162,7 +162,7 @@ private void handleRetryOnException(ExecutionScope executionScope) {
162
162
}
163
163
Optional <Long > nextDelay = execution .nextDelay ();
164
164
165
- nextDelay .ifPresent (
165
+ nextDelay .ifPresentOrElse (
166
166
delay -> {
167
167
log .debug (
168
168
"Scheduling timer event for retry with delay:{} for resource: {}" ,
@@ -171,6 +171,9 @@ private void handleRetryOnException(ExecutionScope executionScope) {
171
171
eventSourceManager
172
172
.getRetryTimerEventSource ()
173
173
.scheduleOnce (executionScope .getCustomResource (), delay );
174
+ },
175
+ () -> {
176
+ log .error ("Exhausted retries for {}" , executionScope );
174
177
});
175
178
}
176
179
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