Skip to content

Refactor retry code on top of tokio-retry2 and macros #50

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

refi64
Copy link
Collaborator

@refi64 refi64 commented Jun 26, 2025

The backoff crate has been unmaintained for a while now, so this switches to tokio-retry2 as gitlab-runner-rs now uses:

collabora/gitlab-runner-rs#90

Additionally, mixing async code with non-FnOnce (especially FnMut) closures can be rather perilous, resulting a maze of extra locks and clones. This is bad as-is in the runner, but tokio-retry2 itself uses an FnMut closure in its API, which makes everything worse. Instead, just switch to a lightweight macro, which also makes it cleaner to pass in a block.

The bulk of the changes are from the new gitlab-runner-rs version, clap,
and switching from the dead `claim` crate to the maintained `claims`
crate.
@refi64 refi64 requested a review from sjoerdsimons June 26, 2025 22:39
@refi64 refi64 force-pushed the wip/refi64/retry-macro branch from a495609 to dfed16e Compare June 27, 2025 14:26
@refi64 refi64 marked this pull request as draft June 27, 2025 15:11
@refi64
Copy link
Collaborator Author

refi64 commented Jun 27, 2025

Marking as draft because it depends on #49.

The `backoff` crate has been unmaintained for a while now, so this
switches to `tokio-retry2` as gitlab-runner-rs now uses:

collabora/gitlab-runner-rs#90

Additionally, mixing async code with non-FnOnce (*especially* FnMut)
closures can be rather perilous, resulting a maze of extra locks and
clones. This is bad as-is in the runner, but `tokio-retry2` itself uses
an FnMut closure in its API, which makes everything worse. Instead, just
switch to a lightweight macro, which also makes it cleaner to pass in a
block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant