Skip to content

Add a retry limit to ConnectionBackoff #784

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

Merged
merged 2 commits into from
May 11, 2020

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented May 7, 2020

Motivation:

See #783

Modifications:

  • Add a retries option to ConnectionBackoff

Result:

Connection attempts may now be made a limited number of times. By
default the behaviour is unchanged.

Resolves #783

Motivation:

See grpc#783

Modifications:

- Add a `retries` option to `ConnectionBackoff`

Result:

Connection attempts may now be made a limited number of times. By
default the behaviour is unchanged.

Resolves grpc#783
@glbrntt glbrntt requested a review from Lukasa May 7, 2020 10:48
/// A limit on the number of times to attempt reconnection.
public var retries: Retries

public struct Retries {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason not to just make this Hashable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


/// A limited number of retry attempts. `limit` must be positive. Note that a limit of zero is
/// identical to `.none`.
public static func limited(to limit: Int) -> Retries {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe upTo(Int).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good suggestion!

@glbrntt glbrntt merged commit 77194a4 into grpc:master May 11, 2020
@glbrntt glbrntt deleted the gb-connection-retry-limit branch May 11, 2020 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit retry count on connection transientFailure
3 participants