Skip to content

fix: delete finished job rows after one day - #298

Merged
jaspermayone merged 1 commit into
mainfrom
fix-clear-finished-jobs
Nov 18, 2026
Merged

jaspermayone merged 1 commit into
mainfrom
fix-clear-finished-jobs

Conversation

@jaspermayone

Copy link
Copy Markdown
Member

Follow-up to GHSA-3rx4-8wxp-j549, which names this gap.

Problem

A finished Solid Queue job row keeps the job arguments. For a magic link or a guardian consent email, the arguments include the raw link token. Nothing deleted finished job rows, and /admin/jobs shows them.

Change

  • config/recurring.yml: a new task, clear_finished_jobs, runs SolidQueue::Job.clear_finished_in_batches each hour.
  • config/application.rb: config.solid_queue.clear_finished_jobs_after = 1.day. This is the gem default. The line makes the retention time visible.
  • spec/config/recurring_spec.rb: checks each entry of config/recurring.yml for a schedule that Solid Queue can read, known keys, and a job class or command method that exists.

Effects to know

  • /admin/jobs shows finished jobs for one day only.
  • The last run of a recurring task goes with its job row. A task that runs less often than daily, such as break_glass_board_report, shows no last run after one day.
  • The first run in production deletes the full backlog, in batches of 500 with a pause between batches.
  • A failed job is not finished. It keeps its arguments until a person retries or discards it. This pull request does not change that.

Checks

  • bundle exec rspec: full suite, 0 failures. The rewritten spec file alone: 60 examples, 0 failures.
  • The new spec fails for a wrong command name and for a wrong schedule (tested by hand).
  • bin/rubocop: no offenses. bin/brakeman: 0 warnings.
  • CI does not run RSpec, so the new spec protects a local run only.

@jaspermayone
jaspermayone requested a review from a team November 18, 2026 16:26
@jaspermayone
jaspermayone merged commit 24fe2d8 into main Nov 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant