Circuit breaker half-open state busy-loops queued tasks with a DB write per spin #306

Open
opened 2026-08-30 03:57:20 +02:00 by clawbot · 0 comments
Collaborator

From audit #303 (significant).

In half-open, Allow() returns false while CooldownRemaining() returns 0 (internal/delivery/circuit_breaker.go:71-73, :85-87), so circuitBreakerBlock reschedules with delay 0 (internal/delivery/target_http.go:145-165): every queued task for the target spins through retryCh with a DB status write per iteration for the whole probe window (up to 30s).

Done: blocked tasks wait a non-zero delay (or until the probe resolves); no per-spin DB writes; test covers half-open with queued tasks.

From audit #303 (significant). In half-open, `Allow()` returns false while `CooldownRemaining()` returns 0 (`internal/delivery/circuit_breaker.go:71-73`, `:85-87`), so `circuitBreakerBlock` reschedules with delay 0 (`internal/delivery/target_http.go:145-165`): every queued task for the target spins through `retryCh` with a DB status write per iteration for the whole probe window (up to 30s). Done: blocked tasks wait a non-zero delay (or until the probe resolves); no per-spin DB writes; test covers half-open with queued tasks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#306