Skip to content

Commit d5cd143

Browse files
Log only when not replaying
Signed-off-by: Mason <[email protected]>
1 parent 8d17f9f commit d5cd143

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,19 +1183,25 @@ private boolean shouldRetry() {
11831183
boolean shouldRetryBasedOnPolicy = this.policy != null ? this.shouldRetryBasedOnPolicy() : true;
11841184
boolean shouldRetryBasedOnHandler = this.handler != null ? this.handler.handle(retryContext) : true;
11851185

1186-
if (this.policy != null) {
1187-
logger.fine(() -> String.format("shouldRetryBasedOnPolicy: %s", shouldRetryBasedOnPolicy));
1188-
}
1186+
// Only log when not replaying, so only the current attempt is logged and not all previous attempts.
1187+
if(!this.context.getIsReplaying()) {
1188+
if (this.policy != null) {
1189+
logger.fine(() -> String.format("shouldRetryBasedOnPolicy: %s", shouldRetryBasedOnPolicy));
1190+
}
11891191

1190-
if (this.handler != null) {
1191-
logger.fine(() -> String.format("shouldRetryBasedOnHandler: %s", shouldRetryBasedOnHandler));
1192+
if (this.handler != null) {
1193+
logger.fine(() -> String.format("shouldRetryBasedOnHandler: %s", shouldRetryBasedOnHandler));
1194+
}
11921195
}
11931196

11941197
return shouldRetryBasedOnPolicy && shouldRetryBasedOnHandler;
11951198
}
11961199

11971200
private boolean shouldRetryBasedOnPolicy() {
1198-
logger.fine(() -> String.format("Retry Policy: %d retries out of total %d performed ", this.attemptNumber, this.policy.getMaxNumberOfAttempts()));
1201+
// Only log when not replaying, so only the current attempt is logged and not all previous attempts.
1202+
if(!this.context.getIsReplaying()) {
1203+
logger.fine(() -> String.format("Retry Policy: %d retries out of total %d performed ", this.attemptNumber, this.policy.getMaxNumberOfAttempts()));
1204+
}
11991205

12001206
if (this.attemptNumber >= this.policy.getMaxNumberOfAttempts()) {
12011207
// Max number of attempts exceeded

0 commit comments

Comments
 (0)