You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplify admission control exceptions and relax Cooldown single restriction
Drop CooldownBlocked and DebounceBlocked in favor of raising AdmissionBlocked
directly with reschedule/retry_delay as constructor arguments. Less ceremony,
same behavior.
Cooldown no longer enforces single=True — multiple per-parameter cooldowns on
the same task are independent and work fine. Debounce keeps single=True because
its reschedule mechanism means multiple debounces would loop forever.
Also trims implementation details (Redis key patterns, Lua scripts) from the
user-facing docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cooldown executes the first submission immediately, then drops duplicates within a window. On entry it atomically sets a Redis key with a TTL (`SET key 1 NX PX window_ms`). If the key already exists the task is silently dropped. The key expires naturally after the window.
426
+
Cooldown executes the first submission immediately, then drops duplicates within a window. If another submission arrives before the window expires, it's silently dropped.
Debounce uses two Redis keys per scope — a **winner** key (which task gets to proceed) and a **last_seen** timestamp — managed by an atomic Lua script:
516
-
517
-
1.**No winner exists** — the task becomes the winner and gets rescheduled for the full settle window.
518
-
2.**Winner returns from reschedule** — if enough time has passed since the last submission, it proceeds. Otherwise it reschedules for the remaining time.
519
-
3.**Non-winner arrives** — updates the last_seen timestamp (resetting the settle timer) and is immediately dropped.
520
-
521
513
### Debounce vs. Cooldown
522
514
523
515
|| Cooldown | Debounce |
@@ -526,6 +518,34 @@ Debounce uses two Redis keys per scope — a **winner** key (which task gets to
526
518
|**Window anchored to**| First execution | Last submission |
527
519
|**Good for**| Deduplicating rapid-fire events | Batching bursts into one action |
528
520
521
+
### Multiple Cooldowns
522
+
523
+
You can annotate multiple parameters with `Cooldown` on the same task. Each gets its own independent window scoped to that parameter's value. A task must pass *all* of its cooldown checks to start — if any one blocks, the task is dropped:
0 commit comments