- Add migration 0004 to introduce 'claiming' status and timeout index - Add StatusClaiming to platformevent domain and allow it in Validate() - Rewrite ListDue as transactional UPDATE ... RETURNING with FOR UPDATE SKIP LOCKED - Add ReleaseStaleClaims to reset expired claiming events back to retrying - Worker Start() now runs a 30s ticker for stale claim recovery (5m timeout) - Update stubEventStore in tests to satisfy new EventStore interface Refs: D-02
12 lines
472 B
SQL
12 lines
472 B
SQL
-- Add 'claiming' status to outbox CHECK constraint and add claim timeout index
|
|
|
|
ALTER TABLE cs_platform_event_outbox
|
|
DROP CONSTRAINT IF EXISTS chk_cs_platform_event_outbox_status;
|
|
|
|
ALTER TABLE cs_platform_event_outbox
|
|
ADD CONSTRAINT chk_cs_platform_event_outbox_status
|
|
CHECK (status IN ('pending','retrying','delivered','dead_letter','claiming'));
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_cs_platform_event_outbox_claiming_timeout
|
|
ON cs_platform_event_outbox(status, updated_at);
|