Skip to Content
Payload Bay

Event retention

Event retention defaults to keeping history indefinitely.

Event retention defaults to keeping history indefinitely. Instance administrators configure it in Installation → Configuration, using 0 to disable automatic pruning or 1–36500 days to retain completed history. Enabling or shortening the window requires explicit confirmation. The saved database setting is shared by web and workers; no environment override or replica-by-replica configuration is needed.

The existing worker checks on startup and once per minute. Changes apply at the next task boundary; a batch already running may finish. PostgreSQL deduplicates one scheduled maintenance job per installation, configured window and UTC hour. Cleanup uses a reserved maintenance slot, separate from email and event-delivery capacity. Each transaction removes at most 100 events and queues a durable continuation when that batch is full. Recovery and retry preserve maintenance priority. No extra service, Docker socket or operator command is required.

An arrival timestamp alone is not sufficient to delete an accepted event. Every associated execution must be terminal with an immutable terminal usage fact older than the configured window. Recent receipts, pending or uncertain HTTP operations, unended attempts, derived events and external replay references prevent deletion. Accepted events missing their processing record are preserved for investigation. Legacy terminal records without trustworthy completion facts are also preserved. Each configured day is exactly 24 elapsed hours, independent of the database session timezone and daylight-saving changes.

Eligible event bodies, receipts, execution/replay records and delivery attempts are removed together. Publications, code, usage facts/counters and audit history are retained. Cleanup writes an aggregate instance audit record without request bodies. It does not erase backups, SMTP messages or externally delivered data. Take and test backups before enabling irreversible deletion.

The database deletion capability belongs to a dedicated NOLOGIN role. Application roles cannot use it; the trusted worker can invoke only the bounded function. Ordinary immutable-history guards remain active. Replay locks the event before creating work. Cleanup locks candidates, then rechecks eligibility in a fresh READ COMMITTED statement; a concurrent replay cannot be removed using a stale snapshot. Deletion, continuation, audit and lease-fenced completion commit or roll back together.

Current verification covers actual PostgreSQL role boundaries, both replay race orders, lease-expiry rollback, bounded continuation, peer scheduling and reserved Graphile capacity. This is not yet published-release install/upgrade/restore certification. The administrator settings view displays the configured window. Committed pruning pushes one payload-free invalidation per affected project through the existing authorized live stream; unrelated projects receive none. Published-release gates remain open.

Edit on GitHub