You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-25Lines changed: 26 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -643,6 +643,32 @@ Rails.application.config.after_initialize do # or to_prepare
643
643
end
644
644
```
645
645
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
+
646
672
### Creating and Deleting Recurring Tasks Dynamically
647
673
648
674
You can create and delete recurring tasks at runtime, without editing the configuration file. Use the following methods:
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
-
711
712
## Inspiration
712
713
713
714
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