feat: retry/backoff module (commons v0.2.0)
add commons.retry: exponential-backoff retry as sync `retry` and async `aretry`, each usable as a call form or a decorator. backoff is min(backoff*factor**n, max_backoff) with optional full jitter; the schedule is a pure generator so it tests without real sleeps (sleep + rand injectable). `on=` narrows retryable exception types, `give_up(exc)` stops early on a non-retryable error, and after attempts are exhausted the LAST exception is re-raised (fail loud, never swallowed). de-dups retry logic written 3x divergently (aiowebhooks 429/5xx, aioproxies burn/rotate, aiomail reconnect). Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
+2
-2
@@ -4,8 +4,8 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "commons"
|
||||
version = "0.1.0"
|
||||
description = "small stdlib-only sync helpers: time/timezone deltas, dotted-path dict access, display masking, and ip/address tooling"
|
||||
version = "0.2.0"
|
||||
description = "small stdlib-only sync helpers: time/timezone deltas, dotted-path dict access, display masking, ip/address tooling, and retry/backoff"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user