diff options
| author | Lin Jen-Shin <godfat@godfat.org> | 2016-10-24 17:38:29 +0800 |
|---|---|---|
| committer | Lin Jen-Shin <godfat@godfat.org> | 2016-10-24 17:38:29 +0800 |
| commit | 780e58fa511c2c817aab1ab3d654524217c3e4c4 (patch) | |
| tree | 09ce04398949381038ad2c3c498ce91744a9b0e8 /doc/development | |
| parent | 383b0e9686a5f7a98cd21e6c5a7c9974f9ea3b80 (diff) | |
| parent | 501bd94de0080aa3802b07f2fb2fd42f3bd0b1cb (diff) | |
| download | gitlab-ce-780e58fa511c2c817aab1ab3d654524217c3e4c4.tar.gz | |
Merge remote-tracking branch 'upstream/master' into pipeline-notifications
* upstream/master: (33 commits)
removes extra line for empty milestone description
code formatting corrected
Fix status code expectation
Stop clearing the database cache on rake cache:clear
Fix error in generating labels
Fix bug where e-mails were not being sent out via Sidekiq
Document link syntax introduced by !5586
Fix documents and comments on Build API `scope`. #23146 #19131
adds entry in CHANGELOG
removes extra line for empty issue description
Re-organize queues to use for Sidekiq
Fix wrong endpoint in api/users documentation, fix same typo in spec describe blocks
Update CHANGELOG
Fix object data to be sent to fetch analytics data
Fixed compare ellipsis messing with layout
Change "Group#web_url" to return "/groups/twitter" rather than "/twitter".
Fix broken label uniqueness label migration
Fix project member access levels
fix font weight of project feature settings
Add hover to trash icon in notes
...
Diffstat (limited to 'doc/development')
| -rw-r--r-- | doc/development/README.md | 3 | ||||
| -rw-r--r-- | doc/development/sidekiq_style_guide.md | 38 |
2 files changed, 40 insertions, 1 deletions
diff --git a/doc/development/README.md b/doc/development/README.md index 9706cb1de7f..fb6a8a5b095 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -14,7 +14,8 @@ - [Testing standards and style guidelines](testing.md) - [UI guide](ui_guide.md) for building GitLab with existing CSS styles and elements - [Frontend guidelines](frontend.md) -- [SQL guidelines](sql.md) for SQL guidelines +- [SQL guidelines](sql.md) for working with SQL queries +- [Sidekiq guidelines](sidekiq_style_guide.md) for working with Sidekiq workers ## Process diff --git a/doc/development/sidekiq_style_guide.md b/doc/development/sidekiq_style_guide.md new file mode 100644 index 00000000000..e3a20f29a09 --- /dev/null +++ b/doc/development/sidekiq_style_guide.md @@ -0,0 +1,38 @@ +# Sidekiq Style Guide + +This document outlines various guidelines that should be followed when adding or +modifying Sidekiq workers. + +## Default Queue + +Use of the "default" queue is not allowed. Every worker should use a queue that +matches the worker's purpose the closest. For example, workers that are to be +executed periodically should use the "cronjob" queue. + +A list of all available queues can be found in `config/sidekiq_queues.yml`. + +## Dedicated Queues + +Most workers should use their own queue. To ease this process a worker can +include the `DedicatedSidekiqQueue` concern as follows: + +```ruby +class ProcessSomethingWorker + include Sidekiq::Worker + include DedicatedSidekiqQueue +end +``` + +This will set the queue name based on the class' name, minus the `Worker` +suffix. In the above example this would lead to the queue being +`process_something`. + +In some cases multiple workers do use the same queue. For example, the various +workers for updating CI pipelines all use the `pipeline` queue. Adding workers +to existing queues should be done with care, as adding more workers can lead to +slow jobs blocking work (even for different jobs) on the shared queue. + +## Tests + +Each Sidekiq worker must be tested using RSpec, just like any other class. These +tests should be placed in `spec/workers`. |
