mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
One latch row per lease address (community, author, installation) replaces row-per-event wake fanout in push_wake_outbox. States idle -> pending -> sending; folds during pending are write-free, folds during sending set only the owed_* triple (claimed identity immutable), every sending exit is the same promote-or-idle rule. Accepted deliveries stamp a durable cooldown_until consulted when the next cycle is armed, bounding accepted wakes to one per address per cooldown window regardless of gateway speed. Migration 0025 creates + seeds the latch table from live legacy outbox rows and leaves push_wake_outbox fully intact for the dual-drain rollout window (0026 owns retirement). Two global partial indexes back the two-arm (pending-due / expired-sending recovery) claim. No caller switches in this commit: relay behavior is unchanged. Covered by 11 PG state-transition tests (incl. fast-gateway cooldown, owed promotion, retry/recovery request_id stability, lease rotation, brownfield seed) plus a populated-database migrator test with an in-flight sending row. Plan: PUSH_LEASE_DB_PERF_PLAN.md Rev 5 (blessed 9/9/9 by Eva + Wren). Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>