phase 2 single provider
2.4.4 — Session Idle-Timeout Sweeper
Goal
Automatically mark sessions as abandoned after a configurable idle period so Phase 3 extraction can process them. Without this, sessions stay active forever and never enter the extraction pipeline.
Acceptance criteria
- Background sweeper runs periodically (configurable interval, default 1 minute)
- Sessions with
status = 'active'andupdated_atolder than idle timeout (default 45 minutes) are markedabandoned - Sweeper is org-scoped (RLS-aware / service-account privileged job; rows retain
org_id) - Metric:
ibex_proxy_session_sweeper_marked_total{status="abandoned"} - Config:
IBEX_SESSION_IDLE_TIMEOUT(default45m),IBEX_SESSION_SWEEP_INTERVAL(default1m) - Documented:
X-IBEX-Session-Endmay still markcompletedwhen wired; idle path marksabandoned - Phase 3.4.2 already documents
status IN ('completed', 'abandoned')for the extraction query
Design notes
Idle means no checkpoint activity: checkpoints bump sessions.updated_at, so never-checkpointed sessions age from create time. Multi-replica proxies coordinate with pg_try_advisory_xact_lock. Batch limit + SKIP LOCKED drain backlogs safely. Redis session cache keys are invalidated on abandon.
Edit on GitHub
Last updated on