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

add support for context.Context #2

Closed
smira opened this issue Sep 2, 2020 · 0 comments · Fixed by #5
Closed

add support for context.Context #2

smira opened this issue Sep 2, 2020 · 0 comments · Fixed by #5
Assignees
Labels
enhancement New feature or request

Comments

@smira
Copy link
Member

smira commented Sep 2, 2020

Retry should respect context cancellation and abort on context cancel; timeout might be implemented via the context

@Ulexus Ulexus added the enhancement New feature or request label Jan 11, 2021
@smira smira self-assigned this Jan 18, 2021
smira added a commit to smira/go-retry that referenced this issue Jan 18, 2021
Existing function `Retry` is maintained with the same API to preserve
backwards compatibility.

New function `RetryWithContext` accepts a context and delivers it to the
retryable function. Each retry attempt can be limited by timeout (via
context, `WithAttemptTimeout`).

Garbage-collected channel `C` which wasn't used.

Replaced stop channel delivery with `close(ch)` to avoid having a
channel with a single entry.

Removed `time.After()` as it leaks the object until timer fires.

Fixes siderolabs#2

Signed-off-by: Andrey Smirnov <[email protected]>
talos-bot pushed a commit that referenced this issue Jan 19, 2021
Existing function `Retry` is maintained with the same API to preserve
backwards compatibility.

New function `RetryWithContext` accepts a context and delivers it to the
retryable function. Each retry attempt can be limited by timeout (via
context, `WithAttemptTimeout`).

Garbage-collected channel `C` which wasn't used.

Replaced stop channel delivery with `close(ch)` to avoid having a
channel with a single entry.

Removed `time.After()` as it leaks the object until timer fires.

Fixes #2

Signed-off-by: Andrey Smirnov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants