Skip to content

Commit 6a883a7

Browse files
committed
Move part of README
1 parent 8499ded commit 6a883a7

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,32 @@ Rails.application.config.after_initialize do # or to_prepare
643643
end
644644
```
645645

646+
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.
647+
648+
**Note**: a single recurring schedule is supported, so you can have multiple schedulers using the same schedule, but not multiple schedulers using different configurations.
649+
650+
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:
651+
```ruby
652+
class MyResqueJob < ApplicationJob
653+
self.queue_adapter = :resque
654+
655+
def perform(arg)
656+
# ..
657+
end
658+
end
659+
```
660+
661+
You can still configure this in Solid Queue:
662+
```yml
663+
my_periodic_resque_job:
664+
class: MyResqueJob
665+
args: 22
666+
schedule: "*/5 * * * *"
667+
```
668+
669+
and the job will be enqueued via `perform_later` so it'll run in Resque. However, in this case we won't track any `solid_queue_recurring_execution` record for it and there won't be any guarantees that the job is enqueued only once each time.
670+
671+
646672
### Creating and Deleting Recurring Tasks Dynamically
647673

648674
You can create and delete recurring tasks at runtime, without editing the configuration file. Use the following methods:
@@ -683,31 +709,6 @@ recurring_task = SolidQueue.schedule_recurring_task(
683709
SolidQueue.delete_recurring_task(recurring_task.id)
684710
```
685711

686-
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.
687-
688-
**Note**: a single recurring schedule is supported, so you can have multiple schedulers using the same schedule, but not multiple schedulers using different configurations.
689-
690-
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:
691-
```ruby
692-
class MyResqueJob < ApplicationJob
693-
self.queue_adapter = :resque
694-
695-
def perform(arg)
696-
# ..
697-
end
698-
end
699-
```
700-
701-
You can still configure this in Solid Queue:
702-
```yml
703-
my_periodic_resque_job:
704-
class: MyResqueJob
705-
args: 22
706-
schedule: "*/5 * * * *"
707-
```
708-
709-
and the job will be enqueued via `perform_later` so it'll run in Resque. However, in this case we won't track any `solid_queue_recurring_execution` record for it and there won't be any guarantees that the job is enqueued only once each time.
710-
711712
## Inspiration
712713

713714
Solid Queue has been inspired by [resque](https://github.com/resque/resque) and [GoodJob](https://github.com/bensheldon/good_job). We recommend checking out these projects as they're great examples from which we've learnt a lot.

0 commit comments

Comments
 (0)