Skip to content

Automatically clean-up old, finished background jobs #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ There are several settings that control how Solid Queue works that you can set a
- `silence_polling`: whether to silence Active Record logs emitted when polling for both workers and dispatchers—defaults to `true`.
- `supervisor_pidfile`: path to a pidfile that the supervisor will create when booting to prevent running more than one supervisor in the same host, or in case you want to use it for a health check. It's `nil` by default.
- `preserve_finished_jobs`: whether to keep finished jobs in the `solid_queue_jobs` table—defaults to `true`.
- `clear_finished_jobs_after`: period to keep finished jobs around, in case `preserve_finished_jobs` is truedefaults to 1 day. **Note:** Right now, there's no automatic cleanup of finished jobs. You'd need to do this by periodically invoking `SolidQueue::Job.clear_finished_in_batches`, which can be configured as [a recurring task](#recurring-tasks).
- `clear_finished_jobs_after`: period to keep finished jobs around, in case `preserve_finished_jobs` is truedefaults to 1 day. **Note:** `SolidQueue` automatically cleans up the finished jobs at 1 AM. To disable this, remove the `automatically_cleanup_finished_jobs` periodic job from the `recurring.yml` configuration.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes to the README could be a little misleading. Even with these changes SolidQueue won't actually clean up the jobs. Instead when you install SolidQueue a job will be created that will clean up jobs.

I could see someone that ran the generator before this change being confused because their jobs aren't being automatically cleaned up and that code won't be in the recurring.yml.

- `default_concurrency_control_period`: the value to be used as the default for the `duration` parameter in [concurrency controls](#concurrency-controls). It defaults to 3 minutes.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
# command: "SoftDeletedRecord.due.delete_all"
# priority: 2
# schedule: at 5am every day
production:
automatically_cleanup_finished_jobs:
command: "SolidQueue::Job.clear_finished_in_batches"
queue: default
schedule: at 1am every day
Loading