Skip to content

Commit 6ac3ad0

Browse files
committed
improved logging
1 parent b1d9f1d commit 6ac3ad0

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

operator-framework/src/main/java/io/javaoperatorsdk/operator/processing/DefaultEventHandler.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ void eventProcessingFinished(
110110
ExecutionScope executionScope, PostExecutionControl postExecutionControl) {
111111
try {
112112
lock.lock();
113-
log.debug("Event processing finished. Scope: {}", executionScope);
113+
log.debug(
114+
"Event processing finished. Scope: {}, PostExecutionControl: {}",
115+
executionScope,
116+
postExecutionControl);
114117
unsetUnderExecution(executionScope.getCustomResourceUid());
115118

116119
if (retry != null && postExecutionControl.exceptionDuringExecution()) {
@@ -143,18 +146,27 @@ private void handleRetryOnException(ExecutionScope executionScope) {
143146
eventBuffer.putBackEvents(executionScope.getCustomResourceUid(), executionScope.getEvents());
144147

145148
if (newEventsExists) {
149+
log.debug("New events exists for for resource id: {}", executionScope.getCustomResourceUid());
146150
executeBufferedEvents(executionScope.getCustomResourceUid());
147151
return;
148152
}
149153
Optional<Long> nextDelay = execution.nextDelay();
154+
150155
nextDelay.ifPresent(
151-
delay ->
152-
eventSourceManager
153-
.getRetryTimerEventSource()
154-
.scheduleOnce(executionScope.getCustomResource(), delay));
156+
delay -> {
157+
log.debug(
158+
"Scheduling timer event for retry with delay:{} for resource: {}",
159+
delay,
160+
executionScope.getCustomResourceUid());
161+
eventSourceManager
162+
.getRetryTimerEventSource()
163+
.scheduleOnce(executionScope.getCustomResource(), delay);
164+
});
155165
}
156166

157167
private void markSuccessfulExecutionRegardingRetry(ExecutionScope executionScope) {
168+
log.debug(
169+
"Marking successful execution for resource: {}", executionScope.getCustomResourceUid());
158170
retryState.remove(executionScope.getCustomResourceUid());
159171
eventSourceManager
160172
.getRetryTimerEventSource()

operator-framework/src/test/java/io/javaoperatorsdk/operator/processing/DefaultEventHandlerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public void successfulExecutionResetsTheRetry() {
183183

184184
defaultEventHandlerWithRetry.handleEvent(event);
185185

186+
log.info("Finished successfulExecutionResetsTheRetry");
187+
186188
ArgumentCaptor<ExecutionScope> executionScopeArgumentCaptor =
187189
ArgumentCaptor.forClass(ExecutionScope.class);
188190
verify(eventDispatcherMock, timeout(SEPARATE_EXECUTION_TIMEOUT).times(3))

0 commit comments

Comments
 (0)