Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,7 @@ final void fail(long now, Throwable throwable) {
// TimeoutException. In this case, we do not get any more retries - the call has
// failed. We increment tries anyway in order to display an accurate log message.
tries++;
if (log.isDebugEnabled()) {
log.debug("{} aborted at {} after {} attempt(s)", this, now, tries,
new Exception(prettyPrintException(throwable)));
}
handleFailure(new TimeoutException("Aborted due to timeout."));
failWithTimeout(now, throwable);
return;
}
// If this is an UnsupportedVersionException that we can retry, do so. Note that a
Expand All @@ -729,13 +725,10 @@ final void fail(long now, Throwable throwable) {
tries++;
nextAllowedTryMs = now + retryBackoffMs;


// If the call has timed out, fail.
if (calcTimeoutMsRemainingAsInt(now, deadlineMs) < 0) {
if (log.isDebugEnabled()) {
log.debug("{} timed out at {} after {} attempt(s)", this, now, tries,
new Exception(prettyPrintException(throwable)));
}
handleFailure(throwable);
failWithTimeout(now, throwable);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below, we have a case where we throw the underlying exception if we run out of retries. Is that intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was debating changing that one too. If retries are exhausted, do we consider that a timeout? I guess it's defensible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if retries are exhausted and it's a retriable exception, then it seems like it should be a TimeoutException.

return;
}
// If the exception is not retryable, fail.
Comment thread
hachikuji marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -763,6 +756,15 @@ final void fail(long now, Throwable throwable) {
runnable.enqueue(this, now);
}

private void failWithTimeout(long now, Throwable cause) {
if (log.isDebugEnabled()) {
log.debug("{} timed out at {} after {} attempt(s)", this, now, tries,
new Exception(prettyPrintException(cause)));
}
handleFailure(new TimeoutException(this + " timed out at " + now
+ " after " + tries + " attempt(s)", cause));
}

/**
* Create an AbstractRequest.Builder for this Call.
*
Expand Down