Skip to content

Commit a5c3f1c

Browse files
committed
Update docs
1 parent 0b15570 commit a5c3f1c

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

doc/development/sidekiq_style_guide.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
This document outlines various guidelines that should be followed when adding or
44
modifying Sidekiq workers.
55

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+
612
## Default Queue
713

814
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`.
1319

1420
## Dedicated Queues
1521

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`.
2826

2927
In some cases multiple workers do use the same queue. For example, the various
3028
workers for updating CI pipelines all use the `pipeline` queue. Adding workers
@@ -38,7 +36,7 @@ tests should be placed in `spec/workers`.
3836

3937
## Removing or renaming queues
4038

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

Comments
 (0)