Skip to content

Document adapter behavior with recurring tasks #561

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

Closed
wants to merge 2 commits into from
Closed
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ end

It's possible to run multiple schedulers with the same `recurring_tasks` configuration, for example, if you have multiple servers for redundancy, and you run the `scheduler` in more than one of them. To avoid enqueuing duplicate tasks at the same time, an entry in a new `solid_queue_recurring_executions` table is created in the same transaction as the job is enqueued. This table has a unique index on `task_key` and `run_at`, ensuring only one entry per task per time will be created. This only works if you have `preserve_finished_jobs` set to `true` (the default), and the guarantee applies as long as you keep the jobs around.

**Note**: It is possible to have different `queue_adapter` settings set for different ActiveJob::Base` subclasses. While solid_queue supports this feature, it will not be aware that a job which is scheduled has, indeed, been enqueued for execution - as Solid Queue only sees its own `jobs` table as the source of truth, and can't "peek" into other adapters' queues. This means that recurring tasks which enqueue jobs into other adapters will reinsert them into their respective adapter repeatedly, every time the recurring tasks are getting scheduled. This is almost certainly not something that you want, so as a rule of thumb: a job class used by a recurring task must be enqueued into Solid Queue and into Solid Queue only.

**Note**: a single recurring schedule is supported, so you can have multiple schedulers using the same schedule, but not multiple schedulers using different configurations.

Finally, it's possible to configure jobs that aren't handled by Solid Queue. That is, you can have a job like this in your app:
Expand Down