Fix #153: bound fan-out goroutines #159

Merged
crueber merged 1 commit from fix/issue-153 into main 2026-09-05 21:03:29 +00:00
Owner

Acquire-before-spawn on all fan-out paths (resolve, createAll, fanoutOne, DeliverRepo): the cap-8 semaphore slot is now taken in the parent loop before go, so in-flight fan-out goroutines are bounded by construction regardless of recipient/hook count. Budget/failed-recipient accounting unchanged.

Regression tests (internal/notify/fanout_bound_test.go): park large fan-outs (200 recipients x3, 64 hooks) on a gate with 8 workers in flight and assert process goroutine delta <= 40. Verified to FAIL on pre-fix code (deltas 201/201/201/89) and pass after.

Checks: gofmt clean, go vet clean, go test -race full internal/notify package green, coverage 96.0% (>= 95% gate). Doc Decisions entry in docs/features/06_notifications.md (law 12).

Acquire-before-spawn on all fan-out paths (resolve, createAll, fanoutOne, DeliverRepo): the cap-8 semaphore slot is now taken in the parent loop before `go`, so in-flight fan-out goroutines are bounded by construction regardless of recipient/hook count. Budget/failed-recipient accounting unchanged. Regression tests (internal/notify/fanout_bound_test.go): park large fan-outs (200 recipients x3, 64 hooks) on a gate with 8 workers in flight and assert process goroutine delta <= 40. Verified to FAIL on pre-fix code (deltas 201/201/201/89) and pass after. Checks: gofmt clean, go vet clean, go test -race full internal/notify package green, coverage 96.0% (>= 95% gate). Doc Decisions entry in docs/features/06_notifications.md (law 12).
resolve, createAll, fanoutOne, DeliverRepo took the cap-8 semaphore
inside the spawned goroutine: one goroutine per recipient/hook spawned
before any throttling. Take the slot in the parent loop before go, so
in-flight fan-out work is bounded by construction. Budget accounting
unchanged. Regression tests park large fan-outs (200/200/200/64) on a
gate and assert bounded goroutine delta; 06_notifications Decisions
updated (law 12).
Author
Owner

Fix ready for review: #159 (branch fix/issue-153). Acquire-before-spawn on resolve/createAll/fanoutOne/DeliverRepo; regression tests fail pre-fix (deltas 201/201/201/89) and pass after; package suite green -race, coverage 96.0%.

Fix ready for review: #159 (branch fix/issue-153). Acquire-before-spawn on resolve/createAll/fanoutOne/DeliverRepo; regression tests fail pre-fix (deltas 201/201/201/89) and pass after; package suite green -race, coverage 96.0%.
Sign in to join this conversation.
No description provided.