1 realtime resume ledger record format
forgejo-actions edited this page 2026-07-11 12:38:13 +00:00

Realtime Resume Ledger Record Format

The realtime resume ledger stores enough session state in Redis for a player to reconnect during the grace window without losing authoritative runtime context.

How It Works

Resume records are stored under realtime:resume:{session_token}. Each record carries a version, session identity, player and gameplay snapshot fields, pending transfer data, and timing information. Missing legacy versions are handled deliberately, while unknown future versions are rejected.

TTL is derived from reconnect grace and pending transfer expiry so stale resume state does not outlive the session contract.

How To Use It

Write a resume record when an active session becomes resumable. Restore it during activation when the session token and timing window are valid. Delete it when the session is no longer resumable or a restored session has consumed the record.

When adding fields, keep old record versions readable or add an explicit migration path.

Invariants

Record keys must be token-scoped. Unknown versions must fail closed. TTL must match the reconnect policy. Pending transfer fields must not resurrect a transfer after its expiry. Restored gameplay state must agree with durable player data before activation continues.

Debugging

Degraded resume records usually point to version mismatch, missing fields, expired TTL, or invalid pending transfer data. Inspect Redis keys, lifecycle journal entries, and session activation logs together.