Skip to content

Commit 7c2e337

Browse files
committed
Add recurring job to delete finished jobs on every hour
Closes #560, #562
1 parent 9ae32cb commit 7c2e337

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ There are several settings that control how Solid Queue works that you can set a
366366
- `silence_polling`: whether to silence Active Record logs emitted when polling for both workers and dispatchers—defaults to `true`.
367367
- `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.
368368
- `preserve_finished_jobs`: whether to keep finished jobs in the `solid_queue_jobs` table—defaults to `true`.
369-
- `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).
369+
- `clear_finished_jobs_after`: period to keep finished jobs around, in case `preserve_finished_jobs` is truedefaults to 1 day. When installing Solid Queue, [a recurring job](#recurring-tasks) is automatically configured to clear finished jobs every hour on the 12th minute in batches. You can edit the `recurring.yml` configuration to change this as you see fit.
370370
- `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.
371371

372372

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
# production:
1+
# shared:
22
# periodic_cleanup:
33
# class: CleanSoftDeletedRecordsJob
44
# queue: background
55
# args: [ 1000, { batch_size: 500 } ]
66
# schedule: every hour
7-
# periodic_command:
7+
# periodic_cleanup_with_command:
88
# command: "SoftDeletedRecord.due.delete_all"
99
# priority: 2
1010
# schedule: at 5am every day
11+
production:
12+
clear_solid_queue_finished_jobs:
13+
command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)"
14+
schedule: every hour at minute 12

0 commit comments

Comments
 (0)