sidekiq 7.3.9 → 8.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +225 -0
  3. data/README.md +34 -14
  4. data/bin/kiq +17 -0
  5. data/bin/lint-herb +13 -0
  6. data/bin/sidekiqload +12 -10
  7. data/bin/webload +69 -0
  8. data/lib/active_job/queue_adapters/sidekiq_adapter.rb +107 -58
  9. data/lib/generators/sidekiq/job_generator.rb +15 -3
  10. data/lib/generators/sidekiq/templates/job.rb.erb +1 -1
  11. data/lib/sidekiq/api.rb +310 -83
  12. data/lib/sidekiq/capsule.rb +10 -7
  13. data/lib/sidekiq/cli.rb +31 -24
  14. data/lib/sidekiq/client.rb +36 -18
  15. data/lib/sidekiq/component.rb +45 -3
  16. data/lib/sidekiq/config.rb +35 -30
  17. data/lib/sidekiq/embedded.rb +2 -1
  18. data/lib/sidekiq/fetch.rb +1 -0
  19. data/lib/sidekiq/iterable_job.rb +1 -0
  20. data/lib/sidekiq/job/iterable.rb +46 -18
  21. data/lib/sidekiq/job.rb +18 -3
  22. data/lib/sidekiq/job_logger.rb +8 -6
  23. data/lib/sidekiq/job_retry.rb +45 -18
  24. data/lib/sidekiq/job_util.rb +5 -1
  25. data/lib/sidekiq/launcher.rb +22 -12
  26. data/lib/sidekiq/loader.rb +57 -0
  27. data/lib/sidekiq/logger.rb +25 -69
  28. data/lib/sidekiq/manager.rb +2 -2
  29. data/lib/sidekiq/metrics/query.rb +77 -46
  30. data/lib/sidekiq/metrics/shared.rb +8 -5
  31. data/lib/sidekiq/metrics/tracking.rb +12 -7
  32. data/lib/sidekiq/middleware/current_attributes.rb +11 -19
  33. data/lib/sidekiq/middleware/i18n.rb +2 -0
  34. data/lib/sidekiq/monitor.rb +4 -8
  35. data/lib/sidekiq/paginator.rb +18 -2
  36. data/lib/sidekiq/processor.rb +26 -18
  37. data/lib/sidekiq/profiler.rb +73 -0
  38. data/lib/sidekiq/rails.rb +46 -67
  39. data/lib/sidekiq/redis_client_adapter.rb +6 -3
  40. data/lib/sidekiq/redis_connection.rb +16 -5
  41. data/lib/sidekiq/ring_buffer.rb +1 -0
  42. data/lib/sidekiq/scheduled.rb +6 -7
  43. data/lib/sidekiq/test_api.rb +331 -0
  44. data/lib/sidekiq/testing/inline.rb +2 -30
  45. data/lib/sidekiq/testing.rb +2 -333
  46. data/lib/sidekiq/transaction_aware_client.rb +13 -5
  47. data/lib/sidekiq/tui/controls.rb +53 -0
  48. data/lib/sidekiq/tui/filtering.rb +53 -0
  49. data/lib/sidekiq/tui/tabs/base_tab.rb +230 -0
  50. data/lib/sidekiq/tui/tabs/busy.rb +104 -0
  51. data/lib/sidekiq/tui/tabs/dead.rb +14 -0
  52. data/lib/sidekiq/tui/tabs/home.rb +115 -0
  53. data/lib/sidekiq/tui/tabs/metrics.rb +114 -0
  54. data/lib/sidekiq/tui/tabs/queues.rb +83 -0
  55. data/lib/sidekiq/tui/tabs/retries.rb +14 -0
  56. data/lib/sidekiq/tui/tabs/scheduled.rb +14 -0
  57. data/lib/sidekiq/tui/tabs/set_tab.rb +91 -0
  58. data/lib/sidekiq/tui/tabs.rb +15 -0
  59. data/lib/sidekiq/tui.rb +390 -0
  60. data/lib/sidekiq/version.rb +2 -2
  61. data/lib/sidekiq/web/action.rb +146 -83
  62. data/lib/sidekiq/web/application.rb +372 -328
  63. data/lib/sidekiq/web/config.rb +117 -0
  64. data/lib/sidekiq/web/helpers.rb +102 -44
  65. data/lib/sidekiq/web/router.rb +61 -77
  66. data/lib/sidekiq/web.rb +65 -151
  67. data/lib/sidekiq.rb +13 -1
  68. data/sidekiq.gemspec +9 -8
  69. data/web/assets/images/logo.png +0 -0
  70. data/web/assets/images/status.png +0 -0
  71. data/web/assets/javascripts/application.js +43 -27
  72. data/web/assets/javascripts/base-charts.js +30 -16
  73. data/web/assets/javascripts/chartjs-adapter-date-fns.min.js +7 -0
  74. data/web/assets/javascripts/dashboard.js +1 -1
  75. data/web/assets/javascripts/metrics.js +16 -34
  76. data/web/assets/stylesheets/style.css +776 -0
  77. data/web/locales/ar.yml +3 -1
  78. data/web/locales/cs.yml +2 -0
  79. data/web/locales/da.yml +2 -0
  80. data/web/locales/de.yml +2 -0
  81. data/web/locales/el.yml +2 -0
  82. data/web/locales/en.yml +8 -0
  83. data/web/locales/es.yml +25 -2
  84. data/web/locales/fa.yml +3 -1
  85. data/web/locales/fr.yml +3 -1
  86. data/web/locales/gd.yml +13 -1
  87. data/web/locales/he.yml +3 -1
  88. data/web/locales/hi.yml +36 -0
  89. data/web/locales/it.yml +9 -0
  90. data/web/locales/ja.yml +2 -0
  91. data/web/locales/ko.yml +2 -0
  92. data/web/locales/lt.yml +2 -0
  93. data/web/locales/nb.yml +2 -0
  94. data/web/locales/nl.yml +2 -0
  95. data/web/locales/pl.yml +2 -0
  96. data/web/locales/{pt-br.yml → pt-BR.yml} +3 -1
  97. data/web/locales/pt.yml +2 -0
  98. data/web/locales/ru.yml +2 -0
  99. data/web/locales/sv.yml +2 -0
  100. data/web/locales/ta.yml +83 -47
  101. data/web/locales/tr.yml +2 -0
  102. data/web/locales/uk.yml +7 -5
  103. data/web/locales/ur.yml +3 -1
  104. data/web/locales/vi.yml +2 -0
  105. data/web/locales/{zh-cn.yml → zh-CN.yml} +86 -73
  106. data/web/locales/{zh-tw.yml → zh-TW.yml} +3 -1
  107. data/web/views/_footer.html.erb +32 -0
  108. data/web/views/_job_info.html.erb +115 -0
  109. data/web/views/_metrics_period_select.html.erb +15 -0
  110. data/web/views/_nav.html.erb +45 -0
  111. data/web/views/_paging.html.erb +26 -0
  112. data/web/views/_poll_link.html.erb +4 -0
  113. data/web/views/{_summary.erb → _summary.html.erb} +16 -16
  114. data/web/views/busy.html.erb +155 -0
  115. data/web/views/dashboard.html.erb +104 -0
  116. data/web/views/dead.html.erb +38 -0
  117. data/web/views/filtering.html.erb +6 -0
  118. data/web/views/layout.html.erb +26 -0
  119. data/web/views/metrics.html.erb +85 -0
  120. data/web/views/metrics_for_job.html.erb +58 -0
  121. data/web/views/morgue.html.erb +69 -0
  122. data/web/views/profiles.html.erb +43 -0
  123. data/web/views/queue.html.erb +57 -0
  124. data/web/views/queues.html.erb +46 -0
  125. data/web/views/retries.html.erb +77 -0
  126. data/web/views/retry.html.erb +39 -0
  127. data/web/views/scheduled.html.erb +64 -0
  128. data/web/views/{scheduled_job_info.erb → scheduled_job_info.html.erb} +3 -3
  129. metadata +65 -47
  130. data/lib/sidekiq/web/csrf_protection.rb +0 -183
  131. data/web/assets/stylesheets/application-dark.css +0 -147
  132. data/web/assets/stylesheets/application-rtl.css +0 -163
  133. data/web/assets/stylesheets/application.css +0 -759
  134. data/web/assets/stylesheets/bootstrap-rtl.min.css +0 -9
  135. data/web/assets/stylesheets/bootstrap.css +0 -5
  136. data/web/views/_footer.erb +0 -34
  137. data/web/views/_job_info.erb +0 -105
  138. data/web/views/_metrics_period_select.erb +0 -12
  139. data/web/views/_nav.erb +0 -52
  140. data/web/views/_paging.erb +0 -25
  141. data/web/views/_poll_link.erb +0 -4
  142. data/web/views/_status.erb +0 -4
  143. data/web/views/busy.erb +0 -148
  144. data/web/views/dashboard.erb +0 -108
  145. data/web/views/dead.erb +0 -34
  146. data/web/views/filtering.erb +0 -6
  147. data/web/views/layout.erb +0 -42
  148. data/web/views/metrics.erb +0 -90
  149. data/web/views/metrics_for_job.erb +0 -59
  150. data/web/views/morgue.erb +0 -74
  151. data/web/views/queue.erb +0 -55
  152. data/web/views/queues.erb +0 -44
  153. data/web/views/retries.erb +0 -79
  154. data/web/views/retry.erb +0 -34
  155. data/web/views/scheduled.erb +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dccc402e8f4e309a47a2adb62418fa29989012e8c94f34aa11200b098dc375f2
4
- data.tar.gz: 71b64a582d5971b045d60bae38dc26da265b60ff9a099ca3b2f9c7df9035e805
3
+ metadata.gz: e02b7ba4c390eb2a743bc62a8938cedd64ee940a6e128b2c517d9c3f27649543
4
+ data.tar.gz: 86b1e8925322fb00b3d443c6aa8762d7d06f9a564276bf1b210c0415c8d571b4
5
5
  SHA512:
6
- metadata.gz: d9148b613a222ca9617ceebe25bb04a5d086edacdafad4a426b6232662d3b583db462dc5e0491297f7859037c5166bcb541bddcd3949f6d3b5a1c2e3fc572b65
7
- data.tar.gz: 93a797cefd1a68adb236c7538c28571467c328d6965af0bc5ce505a1391d6f5b6e2ae2c87b42110e837dcfa8d788aff55309806bbb1bcd181e205c3bc66adc29
6
+ metadata.gz: 63fd4147cf1a9ed566f47266a0c88eb966756285f4404714f2487783a1b754604ab00d5d9b4514002a116598f6005776c6db305c8d66192ec5c8e9b84af71595
7
+ data.tar.gz: a904f9f6963083f76f5645990f068f31b5f3a1a13376d73744b693d6f2e0e2d551be420d70b9c6f97d3ae3ae6691140d21af6357e208e275228ba0061e92df14
data/Changes.md CHANGED
@@ -2,10 +2,235 @@
2
2
 
3
3
  [Sidekiq Changes](https://github.com/sidekiq/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/sidekiq/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/sidekiq/sidekiq/blob/main/Ent-Changes.md)
4
4
 
5
+ 8.1.7
6
+ ----------
7
+
8
+ - Forward compatibililty with Active Job 8.1 [#7019]
9
+ - Many minor fixes and test improvements [hammadxcm]
10
+
11
+ 8.1.6
12
+ ----------
13
+
14
+ - Fix reported thread/memory leak when jobs fail [#7006]
15
+ - Users can limit data displayed on Busy page with the `only` parameter `/busy?only=(jobs|processes)` [#6992]
16
+ - Replace Rack::Utils usage with standard library APIs
17
+ - Several minor fixes from AI scanners.
18
+
19
+ 8.1.5
20
+ ----------
21
+
22
+ - Fix sub-second precision when computing the `retry_for` deadline [#7003]
23
+ - Identify Sidekiq connnections in Redis with `CLIENT SETINFO` [#6986]
24
+ - Fix edge case where Web UI could show an empty Batch set [#6987]
25
+
26
+ 8.1.4
27
+ ----------
28
+
29
+ - The TTIN signal is undeprecated as the INFO signal is not supported on Linux
30
+ - Show iteration job state on Busy page [#6978]
31
+
32
+ 8.1.3
33
+ ----------
34
+
35
+ - Fix edge case leading to duplicate, concurrent execution [#6379]
36
+ If 2 Capsules process jobs from the same queue, long-running
37
+ jobs could run in parallel during process shutdown.
38
+ - [SECURITY] Remove as much YAML usage as possible. [#6950]
39
+ Localization files in `web/locales` are now manually parsed.
40
+ Sidekiq::CLI will now only require YAML if you use a `-C` .yml file.
41
+
42
+ 8.1.2
43
+ ----------
44
+
45
+ - Initial release for `kiq`, Sidekiq's official terminal UI:
46
+ ```
47
+ bundle exec kiq
48
+ ```
49
+ Use REDIS_URL or REDIS_PROVIDER to point `kiq` to Redis.
50
+ - Mutation during iteration in `SortedSet#each` caused it to miss half of the jobs [#6936]
51
+ - Fix edge case resulting in nil crash on /busy page [#6954]
52
+
53
+ 8.1.1
54
+ ----------
55
+
56
+ - **DEPRECATION** `require 'sidekiq/testing'` and
57
+ `require 'sidekiq/testing/inline'`.
58
+ Add new `Sidekiq.testing!(mode)` API [#6931]
59
+ Requiring code should not enable process-wide changes.
60
+ ```ruby
61
+ # Old, implicit
62
+ require "sidekiq/testing"
63
+ require "sidekiq/testing/inline"
64
+ # New, more explicit
65
+ require "sidekiq"
66
+ Sidekiq.testing!(:fake)
67
+ Sidekiq.testing!(:inline)
68
+ ```
69
+ - Fix race condition with Stop button in UI [#6935]
70
+ - Fix javascript error handler [#6893]
71
+
72
+ 8.1.0
73
+ ----------
74
+
75
+ - `retry_for` and `retry` are now mutually exclusive [#6878, Saidbek]
76
+ - `perform_inline` now enforces `strict_args!` [#6718, Saidbek]
77
+ - Integrate Herb linting for ERB templates [#6760, Saidbek]
78
+ - Remove CSRF code, use `Sec-Fetch-Site` header [#6874, deve1212]
79
+ - Allow custom Web UI `assets_path` for CDN purposes [#6865, stanhu]
80
+ - Upgrade to connection_pool 3.0
81
+ - Allow idle connection reaping after N seconds.
82
+ You can activate this **beta** feature like below.
83
+ Feedback requested: is this feature stable and useful for you in production?
84
+ This feature may or may not be enabled by default in Sidekiq 9.0.
85
+ ```ruby
86
+ Sidekiq.configure_server do |cfg|
87
+ cfg.reap_idle_redis_connections(60)
88
+ end
89
+ ```
90
+
91
+ 8.0.10
92
+ ----------
93
+
94
+ - Add confirm dialog for Delete All buttons in Web UI [#6853]
95
+ - Adjust scheduler to run closer to poll average [#6866]
96
+ - Forward compatibility changes for connection_pool 3.0.0
97
+ - Backwards compatibility fix for <8.0.9 process data in Redis [#6870]
98
+ - Backtrace dump can now be triggered with the INFO signal, since Puma uses the
99
+ same signal [#6857]
100
+
101
+ 8.0.9
102
+ ----------
103
+
104
+ - Implement idle Redis connection reaping, will be activated in 8.1 [#6663]
105
+ - Updated `Sidekiq::Process` API to provide capsule data. The `queues` and `weights`
106
+ data will be removed from Redis in Sidekiq 8.1, as this data can now be found in the
107
+ `capsules` element. [#6295]
108
+ - Restore bulk action buttons on Scheduled, Retry and Dead tabs [#6833, deve1212]
109
+ - Support logging additional job attributes [#6846, bschrag620]
110
+ - Fix display of long job args [#6836]
111
+ - Create development lifecycle (`docs/sdlc.md`) and security (`docs/SECURITY.md`) policy
112
+ documentation for Sidekiq's current workflows
113
+
114
+ 8.0.8
115
+ ----------
116
+
117
+ - Allow an optional global iteration max runtime. After executing for this length of time,
118
+ Sidekiq will re-queue the job to continue execution at a later time [#6819, fatkodima]
119
+ ```ruby
120
+ Sidekiq.configure_server do |cfg|
121
+ cfg[:max_iteration_runtime] = 600 # ten minutes
122
+ end
123
+ ```
124
+ - Add `discarded_at` attribute when discarding a job so death handlers can distinguish between
125
+ a job which was killed and one that was discarded. [#6820, gstokkink]
126
+ - `perform_bulk` now accepts an `:at` array of times to schedule each job at the corresponding time.
127
+ `perform_bulk(args: [[1], [2]], at: [Time.now, Time.now + 1])` [#6790, fatkodima]
128
+ - `perform_bulk` now accepts a `:spread_interval` value to schedule jobs over
129
+ the next N seconds. `perform_bulk(..., spread_interval: 60)` [#6792, fatkodima]
130
+ - Fix unintended display of flash messages in the Web UI due to session key collision
131
+ - Add support for lazy load hooks [#6825]
132
+
133
+ 8.0.7
134
+ ----------
135
+
136
+ - The `:discard` option for `sidekiq_retries_exhausted` and `sidekiq_retry_in`
137
+ now calls death handlers, otherwise it could break other Sidekiq
138
+ functionality. [#6741]
139
+ - Provide a Plain log formatter which does not colorize output [#6778]
140
+ - Job iteration now exposes `current_object` for easy access within the `around_iteration` callback [#6774]
141
+ - Fix JS race condition which could skip confirmation dialogs when Live Polling [#6768]
142
+ - Fix edge case which could lose CurrentAttributes [#6767]
143
+ - Update UK locale [#6776]
144
+
145
+ 8.0.6
146
+ ----------
147
+
148
+ - Adjust transactional client to use ActiveRecord 7.2's support for
149
+ `after_all_transactions_commit` when available. [#6765, rewritten]
150
+ - Fix Rails 7.0 and 7.1 compatibility [#6746, mlarraz]
151
+ - Flush metrics at `:exit` [#6764]
152
+
153
+ 8.0.5
154
+ ----------
155
+
156
+ - Add `stopping?` method to AJ adapter for compatibility with the new AJ::Continuations feature [#6732]
157
+ - Further improvements to Rails boot compatibility [#6710]
158
+ - Add ability to disable CSRF middleware. SameSite cookies prevent
159
+ CSRF in a cleaner manner and are default in most browsers now.
160
+ CSRF code will be removed in Sidekiq 9.0. [#6739]
161
+
162
+ 8.0.4
163
+ ----------
164
+
165
+ - Adjust Rails integration for various edge cases [6713]
166
+ - Flush job iteration state when an error is raised [#6704]
167
+ - Update Accept-Language parsing in Web UI [#6721]
168
+ - Remove fixed-width in Web UI [#6686]
169
+ - Adjust CSRF middleware ordering [#6688]
170
+ - Support proxies when POSTing profiles to profiler.firefox.com [#6687]
171
+ - Dont swallow NoMethodErrors in CurrentAttributes [#6685]
172
+
173
+ 8.0.3
174
+ ----------
175
+
176
+ - Configure Vernier output directory [#6674]
177
+ - Rework Rails integration [#6669]
178
+ - Implement flash messages for the Web UI [#6675]
179
+
180
+ 8.0.2
181
+ ----------
182
+
183
+ - Add `on(:exit)` event to run code right before the Sidekiq process exits [#6637]
184
+ - Metrics page crashes with Rack 3.1+ [#6646]
185
+
186
+ 8.0.1
187
+ ----------
188
+
189
+ - Relax Redis requirement to 7.0 for compatibility with AWS and Ubuntu 24.04 LTS. [#6630]
190
+
191
+ 8.0.0
192
+ ----------
193
+
194
+ - **WARNING** The underlying class name for Active Jobs has changed from `ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper` to `Sidekiq::ActiveJob::Wrapper`.
195
+ The old name will still work in 8.x.
196
+ - **WARNING** The `created_at`, `enqueued_at`, `failed_at` and `retried_at` attributes are now stored as epoch milliseconds, rather than epoch floats.
197
+ This is meant to avoid precision issues with JSON and JavaScript's 53-bit Floats.
198
+ Example: `"created_at" => 1234567890.123456` -> `"created_at" => 1234567890123`.
199
+ - **NEW FEATURE** Job Profiling is now supported with [Vernier](https://vernier.prof)
200
+ which makes it really easy to performance tune your slow jobs.
201
+ The Web UI contains a new **Profiles** tab to view any collected profile data.
202
+ Please read the new [Profiling](https://github.com/sidekiq/sidekiq/wiki/Profiling) wiki page for details.
203
+ - **NEW FEATURE** Job Metrics now store up to 72 hours of data and the Web UI allows display of 24/48/72 hours. [#6614]
204
+ - CurrentAttribute support now uses `ActiveJob::Arguments` to serialize the context object, supporting Symbols and GlobalID.
205
+ The change should be backwards compatible. [#6510]
206
+ - Freshen up `Sidekiq::Web` to simplify the code and improve security [#6532]
207
+ The CSS has been rewritten from scratch to remove the Bootstrap framework.
208
+ - Add `on_cancel` callback for iterable jobs [#6607]
209
+ - Add `cursor` reader to get the current cursor inside iterable jobs [#6606]
210
+ - Default error logging has been modified to use Ruby's `Exception#detailed_message` and `#full_message` APIs.
211
+ - CI now runs against Redis, Dragonfly and Valkey.
212
+ - Job tags now allow custom CSS display [#6595]
213
+ - The Web UI's language picker now shows options in the native language
214
+ - Remove global variable usage within the codebase
215
+ - Colorize and adjust logging for easier reading
216
+ - Adjust Sidekiq's default thread priority to -1 for a 50ms timeslice.
217
+ This can help avoid TimeoutErrors when Sidekiq is overloaded. [#6543]
218
+ - Use `Logger#with_level`, remove Sidekiq's custom impl
219
+ - Remove `base64` gem dependency
220
+ - Support: (Dragonfly 1.27+, Valkey 7.2+, Redis 7.2+), Ruby 3.2+, Rails 7.0+
221
+
222
+ 7.3.10
223
+ ----------
224
+
225
+ - Deprecate Redis :password as a String to avoid log disclosure. [#6625]
226
+ Use a Proc instead: `config.redis = { password: ->(username) { "password" } }`
227
+
5
228
  7.3.9
6
229
  ----------
7
230
 
8
231
  - Only require activejob if necessary [#6584]
232
+ You might get `uninitialized constant Sidekiq::ActiveJob` if you
233
+ `require 'sidekiq'` before `require 'rails'`.
9
234
  - Fix iterable job cancellation [#6589]
10
235
  - Web UI accessibility improvements [#6604]
11
236
 
data/README.md CHANGED
@@ -3,22 +3,25 @@ Sidekiq
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
5
5
  ![Build](https://github.com/sidekiq/sidekiq/workflows/CI/badge.svg)
6
+ [![Ruby Users Forum](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=flat&logo=discourse&label=Ruby%20Users%20Forum)](https://www.rubyforum.org/tag/sidekiq)
6
7
 
7
- Simple, efficient background processing for Ruby.
8
+ Simple, efficient background jobs for Ruby.
8
9
 
9
10
  Sidekiq uses threads to handle many jobs at the same time in the
10
- same process. It does not require Rails but will integrate tightly with
11
- Rails to make background processing dead simple.
11
+ same process. Sidekiq can be used by any Ruby application.
12
12
 
13
13
 
14
14
  Requirements
15
15
  -----------------
16
16
 
17
- - Redis: Redis 6.2+ or Dragonfly 1.13+
18
- - Ruby: MRI 2.7+ or JRuby 9.3+.
17
+ - Redis: Redis 7.0+, Valkey 7.2+ or Dragonfly 1.27+
18
+ - Ruby: MRI 3.2+ or JRuby 9.4+.
19
19
 
20
- Sidekiq 7.0 supports Rails 6.0+ but does not require it.
21
- As of 7.2, Sidekiq supports Dragonfly as an alternative to Redis for data storage.
20
+ Sidekiq 8.0 supports Rails and Active Job 7.0+.
21
+
22
+ Sidekiq supports [Valkey](https://valkey.io) and [Dragonfly](https://www.dragonflydb.io) as Redis alternatives.
23
+ Redis 7.2.4 is considered to be the canonical implementation.
24
+ Incompatibilities with that version are considered bugs.
22
25
 
23
26
  Installation
24
27
  -----------------
@@ -42,6 +45,7 @@ The benchmark in `bin/sidekiqload` creates 500,000 no-op jobs and drains them as
42
45
  This requires a lot of Redis network I/O and JSON parsing.
43
46
  This benchmark is IO-bound so we increase the concurrency to 25.
44
47
  If your application is sending lots of emails or performing other network-intensive work, you could see a similar benefit but be careful not to saturate the CPU.
48
+ Real world applications will rarely if ever need to use concurrency greater than 10.
45
49
 
46
50
  Version | Time to process 500k jobs | Throughput (jobs/sec) | Ruby | Concurrency | Job Type
47
51
  -----------------|------|---------|---------|------------------------|---
@@ -62,7 +66,7 @@ Want to Upgrade?
62
66
  Use `bundle up sidekiq` to upgrade Sidekiq and all its dependencies.
63
67
  Upgrade notes between each major version can be found in the `docs/` directory.
64
68
 
65
- I also sell Sidekiq Pro and Sidekiq Enterprise, extensions to Sidekiq which provide more
69
+ I also sell [Sidekiq Pro](https://billing.contribsys.com/spro/) and [Sidekiq Enterprise](https://billing.contribsys.com/sent/new.cgi), extensions to Sidekiq which provide more
66
70
  features, a commercial-friendly license and allow you to support high
67
71
  quality open source development all at the same time. Please see the
68
72
  [Sidekiq](https://sidekiq.org/) homepage for more detail.
@@ -71,7 +75,7 @@ quality open source development all at the same time. Please see the
71
75
  Problems?
72
76
  -----------------
73
77
 
74
- **Please do not directly email any Sidekiq committers with questions or problems.**
78
+ **Do not directly email any Sidekiq committers with questions or problems.**
75
79
  A community is best served when discussions are held in public.
76
80
 
77
81
  If you have a problem, please review the [FAQ](https://github.com/sidekiq/sidekiq/wiki/FAQ) and [Troubleshooting](https://github.com/sidekiq/sidekiq/wiki/Problems-and-Troubleshooting) wiki pages.
@@ -85,22 +89,38 @@ Useful resources:
85
89
  * Product documentation is in the [wiki](https://github.com/sidekiq/sidekiq/wiki).
86
90
  * Occasional announcements are made to the [@sidekiq](https://ruby.social/@sidekiq) Mastodon account.
87
91
  * The [Sidekiq tag](https://stackoverflow.com/questions/tagged/sidekiq) on Stack Overflow has lots of useful Q &amp; A.
92
+ * Join us in the `sidekiq` tag on the [Ruby Users Forum](https://www.rubyforum.org/tag/sidekiq).
88
93
 
89
- Every Thursday morning is Sidekiq office hour: I video chat and answer questions.
90
- See the [Sidekiq support page](https://sidekiq.org/support.html) for details.
94
+ Every Thursday morning is Sidekiq Office Hour: I video chat and answer questions.
95
+ See the [Sidekiq support page](https://sidekiq.org/support/) for details.
91
96
 
92
97
  Contributing
93
98
  -----------------
94
99
 
95
- Please see [the contributing guidelines](https://github.com/sidekiq/sidekiq/blob/main/.github/contributing.md).
100
+ See [the contributing guidelines](https://github.com/sidekiq/sidekiq/blob/main/.github/contributing.md).
101
+
102
+ ### ERB Linting with HERB
103
+
104
+ This project uses [HERB](https://herb-tools.dev/) for ERB file linting and formatting. All ERB files have been renamed to use the `.html.erb` extension for better tooling support.
105
+
106
+ **Local Development:**
107
+ ```bash
108
+ # Run HERB linting
109
+ bundle exec rake lint:herb
110
+ # or
111
+ bin/lint-herb
112
+ ```
113
+
114
+ **CI Integration:**
115
+ HERB linting is automatically run in CI to ensure all ERB files are properly formatted and free of parse errors.
96
116
 
97
117
  License
98
118
  -----------------
99
119
 
100
- Please see [LICENSE.txt](https://github.com/sidekiq/sidekiq/blob/main/LICENSE.txt) for licensing details.
120
+ See [LICENSE.txt](https://github.com/sidekiq/sidekiq/blob/main/LICENSE.txt) for licensing details.
101
121
  The license for Sidekiq Pro and Sidekiq Enterprise can be found in [COMM-LICENSE.txt](https://github.com/sidekiq/sidekiq/blob/main/COMM-LICENSE.txt).
102
122
 
103
123
  Author
104
124
  -----------------
105
125
 
106
- Mike Perham, [@getajobmike](https://ruby.social/@getajobmike) / [@sidekiq](https://ruby.social/@sidekiq), [https://www.mikeperham.com](https://www.mikeperham.com) / [https://www.contribsys.com](https://www.contribsys.com)
126
+ Mike Perham, [mastodon](https://ruby.social/@getajobmike), [https://www.mikeperham.com](https://www.mikeperham.com) / [https://www.contribsys.com](https://www.contribsys.com)
data/bin/kiq ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This requires the default gemset so Sidekiq Pro
4
+ # and Sidekiq Enterprise can load any code extensions.
5
+ Bundler.require(:default, :tui)
6
+
7
+ require_relative "../lib/sidekiq/tui"
8
+
9
+ # Run any load hooks registered during Bundler.require
10
+ Sidekiq.loader.run_load_hooks(:tui)
11
+
12
+ tt = Sidekiq::TUI.new(Sidekiq.default_configuration)
13
+
14
+ RatatuiRuby.run do |tui|
15
+ tt.prepare(tui)
16
+ tt.run_loop
17
+ end
data/bin/lint-herb ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # HERB Linting Script
5
+ # Run this script to lint all ERB files in the project
6
+ # Usage: bin/lint-herb
7
+
8
+ require "bundler/setup"
9
+
10
+ puts "🔍 Running HERB linting on ERB files..."
11
+ puts
12
+
13
+ exec("bundle exec herb analyze web/views -n --no-log-file")
data/bin/sidekiqload CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ ENV["RUBY_TCP_NO_FAST_FALLBACK"] = "1"
4
+
3
5
  #
4
6
  # bin/sidekiqload is a helpful script to load test and
5
7
  # performance tune Sidekiq's core. It creates 500,000 no-op
@@ -28,7 +30,7 @@ require "ruby-prof" if ENV["PROFILE"]
28
30
  require "bundler/setup"
29
31
  Bundler.require(:default, :load_test)
30
32
 
31
- latency = Integer(ENV["LATENCY"] || 1)
33
+ latency = Integer(ENV["LATENCY"] || 0)
32
34
  if latency > 0
33
35
  # brew tap shopify/shopify
34
36
  # brew install toxiproxy
@@ -86,7 +88,7 @@ class Loader
86
88
  def initialize
87
89
  @iter = ENV["GC"] ? 10 : 500
88
90
  @count = Integer(ENV["COUNT"] || 1_000)
89
- @latency = Integer(ENV["LATENCY"] || 1)
91
+ @latency = Integer(ENV["LATENCY"] || 0)
90
92
  end
91
93
 
92
94
  def configure
@@ -137,7 +139,7 @@ class Loader
137
139
  end
138
140
 
139
141
  def setup
140
- Sidekiq.logger.error("Setup RSS: #{Process.rss}")
142
+ Sidekiq.logger.warn("Setup RSS: #{Process.rss}")
141
143
  Sidekiq.redis { |c| c.flushdb }
142
144
  start = Time.now
143
145
  if ENV["AJ"]
@@ -167,9 +169,9 @@ class Loader
167
169
  if total == 0
168
170
  ending = Time.now - @start
169
171
  size = @iter * @count
170
- Sidekiq.logger.error("Done, #{size} jobs in #{ending} sec, #{(size / ending).to_i} jobs/sec")
171
- Sidekiq.logger.error("Ending RSS: #{Process.rss}")
172
- Sidekiq.logger.error("Now here's the latency for three jobs")
172
+ Sidekiq.logger.warn("Done, #{size} jobs in #{ending} sec, #{(size / ending).to_i} jobs/sec")
173
+ Sidekiq.logger.warn("Ending RSS: #{Process.rss}")
174
+ Sidekiq.logger.warn("Now here's the latency for three jobs")
173
175
 
174
176
  if ENV["AJ"]
175
177
  LoadJob.perform_later("", 1, {}, Time.now.to_f)
@@ -191,7 +193,7 @@ class Loader
191
193
  end
192
194
 
193
195
  def with_latency(latency, &block)
194
- Sidekiq.logger.error "Simulating #{latency}ms of latency between Sidekiq and redis"
196
+ Sidekiq.logger.warn "Simulating #{latency}ms of latency between Sidekiq and redis"
195
197
  if latency > 0
196
198
  Toxiproxy[:redis].downstream(:latency, latency: latency).apply(&block)
197
199
  else
@@ -204,8 +206,8 @@ class Loader
204
206
  monitor
205
207
 
206
208
  if ENV["PROFILE"]
207
- RubyProf.exclude_threads = [@monitor]
208
- RubyProf.start
209
+ $profile = RubyProf::Profile.new(exclude_threads: [@monitor])
210
+ $profile.start
209
211
  elsif ENV["GC"]
210
212
  GC.start
211
213
  GC.compact
@@ -236,7 +238,7 @@ class Loader
236
238
  Sidekiq.logger.error("GC End RSS: #{Process.rss}") if ENV["GC"]
237
239
  if ENV["PROFILE"]
238
240
  Sidekiq.logger.error("Profiling...")
239
- result = RubyProf.stop
241
+ result = $profile.stop
240
242
  printer = RubyProf::GraphHtmlPrinter.new(result)
241
243
  printer.print(File.new("output.html", "w"), min_percent: 1)
242
244
  end
data/bin/webload ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ Bundler.setup
5
+
6
+ # This skeleton allows you to run Sidekiq::Web page rendering
7
+ # through Vernier for tuning.
8
+ require "sidekiq/web"
9
+ require "rack/test"
10
+ require "vernier"
11
+
12
+ Sidekiq::Web.configure do |config|
13
+ config.middlewares.clear # remove csrf
14
+ end
15
+
16
+ class SomeJob
17
+ include Sidekiq::Job
18
+ end
19
+
20
+ class BenchWeb
21
+ include Rack::Test::Methods
22
+
23
+ def app
24
+ Sidekiq::Web.new
25
+ end
26
+
27
+ def warmup(page = "/scheduled")
28
+ # Sidekiq.redis {|c| c.flushdb }
29
+
30
+ # 100.times do |idx|
31
+ # SomeJob.perform_at(idx, 1, 3, "mike", {"foo" => "bar"})
32
+ # end
33
+
34
+ 100.times do
35
+ get page
36
+ end
37
+ end
38
+
39
+ def load(page = "/scheduled", count = 10_000)
40
+ profile do
41
+ count.times do
42
+ get page
43
+ raise last_response.inspect unless last_response.status == 200
44
+ end
45
+ end
46
+ end
47
+
48
+ def profile(&)
49
+ if ENV["PROF"]
50
+ Vernier.profile(out: "profile.json.gz", &)
51
+ else
52
+ yield
53
+ end
54
+ end
55
+ end
56
+
57
+ def timer(name="block", count = 10_000)
58
+ a = Time.now
59
+ yield count
60
+ b = Time.now
61
+ puts "#{name} in #{b - a} sec"
62
+ end
63
+
64
+ page = "/busy"
65
+ b = BenchWeb.new
66
+ b.warmup(page)
67
+ timer(page) do |count|
68
+ b.load(page, count)
69
+ end