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
{{ message }}
Repository navigation
fix(webhook_out): the approval event sender sends inline on one thread, so a hung destination stalls the rest #980
ApprovalSender::look (crates/tole-cli/src/webhook_out/approval_sender.rs) sends every due event synchronously on the one sender thread started by spawn.
A destination may set timeout_secs up to 30 (MAX_TIMEOUT_SECS).
A fresh event has next_at = 0, so all queued events for an unreachable destination (up to 256, MAX_PER_DESTINATION) are due at once. Each blocks up to its timeout before it is requeued.
take_due is called again until nothing is due or 1000 sends were made (MAX_SENDS_PER_LOOK).
While that runs:
other destinations receive nothing, although take_due hands out one event per destination;
(self.expire)() runs only at the top of look, so unanswered approvals are not expired, and their approval_resolved(expired) events are not even produced.
Turns are not affected: the notifier only pushes to the queue and never does I/O. The cost is notification latency for healthy destinations and late expiry events.
A second, smaller defect in the same function: when a retry comes back to a full queue, requeue(ev) returns Err and the result is ignored. The event is neither counted as gave_up nor reported through failed, and the event lost is the oldest (already retried) one, not the newest.
Expected
A slow or dead destination must not delay other destinations or the expiry timer.
Suggested fix
Send per destination (one worker per destination), or bound one look by wall-clock time and by consecutive failures per destination, and call expire between sends.
Count a refused requeue as gave_up and call failed(&ev.dest, "queue_full").
Test: two destinations, one that hangs until the client timeout and one that answers; assert the healthy one is delivered within one poll interval, and that an approval expires on schedule while the other is hanging.
Why it matters now
The turn_finished event proposed in #962 (docs/turn-finished-event.md, option A) would reuse this queue and sender, so it inherits the stall.
Evidence
Found by a cora scan agent-as-reviewer pass (cora 0.21.1) over webhook_out/*; the look, take_due and MAX_TIMEOUT_SECS behaviour was confirmed in the source.
Activity
docs(webhook_out): record the cora scan check and its prerequisite bu…
fix(webhook_out): deflake the hung-destination test and report a refu…
fix(webhook_out): one worker per destination so a hung one stalls not…