Skip to content

Add Retry.forever() and ExponentialRetry.forever() classmethods#373

Merged
chrisguidry merged 4 commits intomainfrom
359-retry-forever-devx
Mar 26, 2026
Merged

Add Retry.forever() and ExponentialRetry.forever() classmethods#373
chrisguidry merged 4 commits intomainfrom
359-retry-forever-devx

Conversation

@chrisguidry
Copy link
Copy Markdown
Owner

Retry(attempts=None) works but reads like "no value" rather than "keep going".
Retry.forever() and ExponentialRetry.forever() are factory classmethods that
say what they mean — they just return instances with attempts=None internally,
so existing code is unaffected.

Also updated the chaos suite (which was using Retry(attempts=sys.maxsize) to
avoid the None weirdness) and the docs to lead with the new API.

Closes #359

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

`Retry(attempts=None)` works but reads like "no value" rather than "keep going".
`Retry.forever()` and `ExponentialRetry.forever()` are factory classmethods that
say what they mean — they just return instances with `attempts=None` internally,
so existing code is unaffected.

Also updated the chaos suite (which was using `Retry(attempts=sys.maxsize)` to
avoid the `None` weirdness) and the docs to lead with the new API.

Closes #359

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 26, 2026

Documentation build overview

📚 docket | 🛠️ Build #31992531 | 📁 Comparing c884169 against latest (9a2c57a)


🔍 Preview build

Show files changed (2 files in total): 📝 2 modified | ➕ 0 added | ➖ 0 deleted
File Status
api-reference/index.html 📝 modified
task-behaviors/index.html 📝 modified

chrisguidry and others added 3 commits March 26, 2026 16:39
The `if outcome.exception:` guard was unreachable — the worker always passes an
exception to handle_failure. Removed the branch instead of writing a contorted
test to cover it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The worker always passes an exception to handle_failure, so make that contract
explicit with an assert rather than silently accepting None.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The chaos suite can run against older installed versions of docket where
Retry.forever() doesn't exist yet. We can switch this over in a future release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chrisguidry chrisguidry merged commit a361a23 into main Mar 26, 2026
92 of 93 checks passed
@chrisguidry chrisguidry deleted the 359-retry-forever-devx branch March 26, 2026 21:07
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.

Retry(attempts=None) feels like wrong way to say "keep trying forever"

1 participant