Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix off-by-one in RetryingChannel, use the configured number of retries #367

Merged
merged 3 commits into from
Feb 18, 2020

Conversation

carterkozak
Copy link
Contributor

==COMMIT_MSG==
Fix off-by-one in RetryingChannel, use the configured number of retries
==COMMIT_MSG==

Possible downsides?

Doesn't support the configured backoff interval yet.

@changelog-app
Copy link

changelog-app bot commented Feb 18, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Fix off-by-one in RetryingChannel, use the configured number of retries

Check the box to generate changelog(s)

  • Generate changelog entry

// TODO(dfox): include retry number in the request somehow
return delegate.execute(endpoint, request);
};
FutureCallback<Response> retryer = new RetryingCallback(callSupplier, future);
Futures.addCallback(callSupplier.apply(0), retryer, DIRECT_EXECUTOR);

DialogueFutures.addDirectCallback(callSupplier.apply(0), retryer);
return future;
}

private final class RetryingCallback implements FutureCallback<Response> {
private final AtomicInteger failures = new AtomicInteger(0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be an int given that retries are sequenced we can rely on the happens-before relationship.

Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to make that change as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add it to a an improvement on top of this PR, might be best if you'd like to review that in isolation :-]

@ferozco
Copy link
Contributor

ferozco commented Feb 18, 2020

👍

* fix #311: RetryingChannel propagates cancelation

Generally safer by using existing utility functionality to chain
futures instead of reimplementing async-transformation via
callbacks.
@bulldozer-bot bulldozer-bot bot merged commit 093c647 into develop Feb 18, 2020
@bulldozer-bot bulldozer-bot bot deleted the ckozak/fix_retry branch February 18, 2020 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants