Skip to content

Commit ff6f8f4

Browse files
authored
Merge pull request #386 from alex268/fix_session_retry_context
Added onLimit method for retryable exceptions
2 parents c4f825c + 58d0830 commit ff6f8f4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

table/src/main/java/tech/ydb/table/SessionRetryContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ private void handleException(@Nonnull Throwable ex) {
266266
handler.onRetry(SessionRetryContext.this, ex, retry, next, ms());
267267
scheduleNext(next);
268268
} else {
269-
handler.onError(SessionRetryContext.this, ex, maxRetries, ms());
269+
handler.onLimit(SessionRetryContext.this, ex, maxRetries, ms());
270270
promise.completeExceptionally(ex);
271271
}
272272
}

table/src/main/java/tech/ydb/table/SessionRetryHandler.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ default void onLimit(SessionRetryContext context, StatusCode code,
8787
context.hashCode(), code, retryLimit, millis);
8888
}
8989

90+
/**
91+
* Called on retryable exception when the limit is reached.
92+
*
93+
* @param context Session retry object
94+
* @param issue Retryable exception
95+
* @param retryLimit Maximum number of retries
96+
* @param millis Elapsed time
97+
*/
98+
default void onLimit(SessionRetryContext context, Throwable issue,
99+
int retryLimit, long millis) {
100+
LOGGER.debug("RetryCtx[{}] RETRYABLE ERROR[{}], finished by retries limit ({}), {} ms total",
101+
context.hashCode(), errorMsg(issue), retryLimit, millis);
102+
}
103+
90104
/**
91105
* Called on non-retryable error.
92106
*

0 commit comments

Comments
 (0)