3
3
This document outlines various guidelines that should be followed when adding or
4
4
modifying Sidekiq workers.
5
5
6
+ ## ApplicationWorker
7
+
8
+ All workers should include ` ApplicationWorker ` instead of ` Sidekiq::Worker ` ,
9
+ which adds some convenience methods and automatically sets the queue based on
10
+ the worker's name.
11
+
6
12
## Default Queue
7
13
8
14
Use of the "default" queue is not allowed. Every worker should use a queue that
@@ -13,18 +19,10 @@ A list of all available queues can be found in `config/sidekiq_queues.yml`.
13
19
14
20
## Dedicated Queues
15
21
16
- Most workers should use their own queue. To ease this process a worker can
17
- include the ` DedicatedSidekiqQueue ` concern as follows:
18
-
19
- ``` ruby
20
- class ProcessSomethingWorker
21
- include ApplicationWorker
22
- end
23
- ```
24
-
25
- This will set the queue name based on the class' name, minus the ` Worker `
26
- suffix. In the above example this would lead to the queue being
27
- ` process_something ` .
22
+ Most workers should use their own queue, which is automatically set based on the
23
+ worker class name. For a worker named ` ProcessSomethingWorker ` , the queue name
24
+ would be ` process_something ` . If you're not sure what a worker's queue name is,
25
+ you can find it using ` SomeWorker.queue ` .
28
26
29
27
In some cases multiple workers do use the same queue. For example, the various
30
28
workers for updating CI pipelines all use the ` pipeline ` queue. Adding workers
@@ -38,7 +36,7 @@ tests should be placed in `spec/workers`.
38
36
39
37
## Removing or renaming queues
40
38
41
- Try to avoid renaming or removing queues in minor and patch releases.
42
- During online update instance can have pending jobs and removing the queue can
43
- lead to those jobs being stuck forever. If you can't write migration for those
44
- Sidekiq jobs, please consider doing rename or remove queue in major release only.
39
+ Try to avoid renaming or removing queues in minor and patch releases.
40
+ During online update instance can have pending jobs and removing the queue can
41
+ lead to those jobs being stuck forever. If you can't write migration for those
42
+ Sidekiq jobs, please consider doing rename or remove queue in major release only.
0 commit comments