Skip to content

What is kept, and for how long ​

RustCMS deletes expired data on its own, once per period, in background passes. This page lists what each table keeps, which pass deletes it, and which commands do the same from cron when no long-running process is up.

Background passes ​

The auth, idempotency, media and exports cleanups are framework schedules (rustcms.auth-prune, rustcms.idempotency-prune, rustcms.media-prune.<disk>, rustcms.exports-prune.<disk>): they run only in serve with [schedule] enabled (the default, except in API mode), once per slot across instances (UTC), never in queue:work, console commands or tests. They show on System → Schedules and in schedule:list with their runs and summaries.

Files an instance stages on its own disk are its own to sweep: every serve (whatever its mode) and queue:work removes the abandoned ones (uploads, exports and imports interrupted by a crash, older than an hour) at start and every 10 minutes; queue:work --once and media:prune do it once.

PassEveryFirst runDeletes
auth cleanup (rustcms.auth-prune, serve only)hournext full hourexpired sessions, ended JWT sign-ins, expired reset and invitation links, audit entries past retention
idempotency cleanup (rustcms.idempotency-prune, serve only)hournext full hourexpired idempotency receipts
media cleanup (rustcms.media-prune.<disk>, serve only)minutenext full minutefiles of deleted media records, abandoned uploads
exports and imports cleanup (rustcms.exports-prune.<disk>, serve only)10 minutesnext multiple of 10 minutesexpired exports and imports, with their files
staging sweep (each serve and queue:work)10 minutesat startthis instance's staged files older than an hour
scheduler (serve only, while schedules are registered and [schedule] enabled)hourafter one hourschedule claims older than 7 days, schedule runs past retention
queue workers (serve with workers, queue:work)hourat startfailed jobs and once receipts, job history, schedule runs past retention

What is kept ​

DataKeptDeleted by
Sessionsuntil idle session_lifetime_minutes (remembered: remember_days)auth cleanup, session:prune
JWT sign-insuntil their family ends (refresh_family_days)auth cleanup, session:prune
Reset and invitation linksuntil they expire (marks of credential changes: 30 days)auth cleanup, schedule:run rustcms.auth-prune
Audit entriesaudit.retention_days (365)auth cleanup, audit:prune
Idempotency receipts24 hoursidempotency cleanup, idempotency:prune
Schedule claims (schedule_slots)7 days (schedule_states are kept)the scheduler only
Failed jobs, once receiptsqueue.failed_retention_days (30)the workers, queue:work --once
Job history (job_runs)queue.history_retention_days (7; 0 keeps no history)the workers, queue:work --once
Schedule runs (schedule_runs)schedule.history_retention_days (7)the scheduler, the workers, queue:work --once
Background exports (file and row)24 hours, removed an hour laterexports and imports cleanup, schedule:run rustcms.exports-prune.<disk>
Imports (file, row, report, receipts)24 hours from upload, or from the start of the runexports and imports cleanup, schedule:run rustcms.exports-prune.<disk>
Media files of deleted media records, interrupted uploadsremoved within minutes (queued deletions), an hour (abandoned uploads)media cleanup, media:prune
Uploaded mediauntil deleted from the Media library (a cover removed from a record, or an abandoned draft's, stays)by hand

From cron ​

When serve is not running all the time (workers only, maintenance windows), run the commands from cron:

sh
rustcms session:prune       # sessions and ended JWT sign-ins
rustcms schedule:run rustcms.auth-prune   # or: the whole auth cleanup, reset links included
rustcms audit:prune
rustcms idempotency:prune
rustcms media:prune         # and this instance's abandoned staged files
rustcms schedule:run rustcms.exports-prune.local   # or .s3: the disk in use
rustcms queue:work --once   # failed jobs, receipts, job and schedule history (and the ready jobs)

rustcms schedule:run rustcms.auth-prune runs the whole auth cleanup once, reset and invitation links included (no other command deletes those), and records the run in the schedule history; it does not prune that history, nor schedule claims (only serve's scheduler and the workers do). schedule:run rustcms.exports-prune.<disk> deletes expired exports and imports the same way.

Personal data ​

Queued jobs hold their payload until they are done or, failed, until pruned: a password reset job holds the address it was asked for (never a link). Audit entries hold user ids, addresses and user agents. Keep backups of the database as protected as the database itself.

RustCMS 0.17.0 · source cfb82fa33fab · MIT OR Apache-2.0