sidekiq 6.0.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq might be problematic. Click here for more details.

Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +258 -2
  3. data/LICENSE +1 -1
  4. data/README.md +6 -8
  5. data/bin/sidekiq +26 -2
  6. data/bin/sidekiqload +8 -4
  7. data/bin/sidekiqmon +4 -5
  8. data/lib/generators/sidekiq/worker_generator.rb +11 -1
  9. data/lib/sidekiq/api.rb +220 -145
  10. data/lib/sidekiq/cli.rb +64 -27
  11. data/lib/sidekiq/client.rb +31 -14
  12. data/lib/sidekiq/extensions/action_mailer.rb +3 -2
  13. data/lib/sidekiq/extensions/active_record.rb +4 -3
  14. data/lib/sidekiq/extensions/class_methods.rb +5 -4
  15. data/lib/sidekiq/extensions/generic_proxy.rb +3 -1
  16. data/lib/sidekiq/fetch.rb +36 -27
  17. data/lib/sidekiq/job.rb +13 -0
  18. data/lib/sidekiq/job_logger.rb +13 -5
  19. data/lib/sidekiq/job_retry.rb +27 -17
  20. data/lib/sidekiq/launcher.rb +110 -28
  21. data/lib/sidekiq/logger.rb +109 -12
  22. data/lib/sidekiq/manager.rb +4 -4
  23. data/lib/sidekiq/middleware/chain.rb +17 -6
  24. data/lib/sidekiq/middleware/current_attributes.rb +48 -0
  25. data/lib/sidekiq/monitor.rb +3 -18
  26. data/lib/sidekiq/paginator.rb +7 -2
  27. data/lib/sidekiq/processor.rb +22 -24
  28. data/lib/sidekiq/rails.rb +27 -18
  29. data/lib/sidekiq/redis_connection.rb +19 -13
  30. data/lib/sidekiq/scheduled.rb +37 -11
  31. data/lib/sidekiq/sd_notify.rb +149 -0
  32. data/lib/sidekiq/systemd.rb +24 -0
  33. data/lib/sidekiq/testing.rb +14 -4
  34. data/lib/sidekiq/util.rb +28 -2
  35. data/lib/sidekiq/version.rb +1 -1
  36. data/lib/sidekiq/web/action.rb +2 -2
  37. data/lib/sidekiq/web/application.rb +37 -30
  38. data/lib/sidekiq/web/csrf_protection.rb +180 -0
  39. data/lib/sidekiq/web/helpers.rb +51 -33
  40. data/lib/sidekiq/web/router.rb +6 -5
  41. data/lib/sidekiq/web.rb +37 -73
  42. data/lib/sidekiq/worker.rb +78 -14
  43. data/lib/sidekiq.rb +24 -8
  44. data/sidekiq.gemspec +13 -6
  45. data/web/assets/images/apple-touch-icon.png +0 -0
  46. data/web/assets/javascripts/application.js +83 -64
  47. data/web/assets/javascripts/dashboard.js +53 -53
  48. data/web/assets/stylesheets/application-dark.css +147 -0
  49. data/web/assets/stylesheets/application-rtl.css +0 -4
  50. data/web/assets/stylesheets/application.css +43 -230
  51. data/web/locales/ar.yml +8 -2
  52. data/web/locales/de.yml +14 -2
  53. data/web/locales/en.yml +6 -1
  54. data/web/locales/es.yml +18 -2
  55. data/web/locales/fr.yml +10 -3
  56. data/web/locales/ja.yml +5 -0
  57. data/web/locales/lt.yml +83 -0
  58. data/web/locales/pl.yml +4 -4
  59. data/web/locales/ru.yml +4 -0
  60. data/web/locales/vi.yml +83 -0
  61. data/web/views/_footer.erb +1 -1
  62. data/web/views/_job_info.erb +3 -2
  63. data/web/views/_poll_link.erb +2 -5
  64. data/web/views/_summary.erb +7 -7
  65. data/web/views/busy.erb +54 -20
  66. data/web/views/dashboard.erb +22 -14
  67. data/web/views/dead.erb +3 -3
  68. data/web/views/layout.erb +3 -1
  69. data/web/views/morgue.erb +9 -6
  70. data/web/views/queue.erb +19 -10
  71. data/web/views/queues.erb +10 -2
  72. data/web/views/retries.erb +11 -8
  73. data/web/views/retry.erb +3 -3
  74. data/web/views/scheduled.erb +5 -2
  75. metadata +29 -50
  76. data/.circleci/config.yml +0 -61
  77. data/.github/contributing.md +0 -32
  78. data/.github/issue_template.md +0 -11
  79. data/.gitignore +0 -13
  80. data/.standard.yml +0 -20
  81. data/3.0-Upgrade.md +0 -70
  82. data/4.0-Upgrade.md +0 -53
  83. data/5.0-Upgrade.md +0 -56
  84. data/6.0-Upgrade.md +0 -70
  85. data/COMM-LICENSE +0 -97
  86. data/Ent-2.0-Upgrade.md +0 -37
  87. data/Ent-Changes.md +0 -250
  88. data/Gemfile +0 -24
  89. data/Gemfile.lock +0 -196
  90. data/Pro-2.0-Upgrade.md +0 -138
  91. data/Pro-3.0-Upgrade.md +0 -44
  92. data/Pro-4.0-Upgrade.md +0 -35
  93. data/Pro-5.0-Upgrade.md +0 -25
  94. data/Pro-Changes.md +0 -768
  95. data/Rakefile +0 -10
  96. data/code_of_conduct.md +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fda3ed37e1d981e1b32eea70669c678d400c071a9146a919848bcc598612de25
4
- data.tar.gz: 6580ab6c188b2514efe807479ca25c06ea584d1def175d84d94639bc20f80b1e
3
+ metadata.gz: b72b92d3d281aaea2b4781cb7743d95a8c7f42708526383bf85fbed420b4b82c
4
+ data.tar.gz: 9546107658b47c8f68497730e2ee6689881c1388ba96db3f2415b0fda7b7f668
5
5
  SHA512:
6
- metadata.gz: 25682d3dbf99d29fa3f56b7c74419863d3549b6e0c182e69c83fbc02a2955d053bca85eec53b474d4d22c7526e44e865f378aa4111152a91377b373be27c4d47
7
- data.tar.gz: e55d07434b1e2ab26df6748101bf10640fc08d4d93f00b75ed04d82ed309ee8529d652982430cd00671c98b5e53cc733bef4b686df58a6b0e116ba04c12139aa
6
+ metadata.gz: 78f0af1f4ed41c5b4ad01636d9808d409d1cedc0bc6146be278412e87f9d826fad2cec9c89b31acbc6da9bab59bff44e826418991b10ce27b34631bcc3a00cf2
7
+ data.tar.gz: a586b9ec613cf3da47ecb77eb4e0f5d6e497f234369d958cdfa3d8c8c7418806383e022a9b08db4c3b5d08a1c2aac3aaecdf851744234f4c42055e1a7a6ebf6c
data/Changes.md CHANGED
@@ -1,13 +1,250 @@
1
1
  # Sidekiq Changes
2
2
 
3
- [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
3
+ [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/main/Ent-Changes.md)
4
+
5
+ HEAD
6
+ ---------
7
+
8
+ - **BREAK**: The Web UI has been refactored to remove jQuery. Any UI extensions
9
+ which use jQuery will break.
10
+ - **FEATURE**: Sidekiq.logger has been enhanced so any `Rails.logger`
11
+ output in jobs now shows up in the Sidekiq console. Remove any logger
12
+ hacks in your initializer and see if it Just Works™ now. [#5021]
13
+ - **FEATURE**: Add `Sidekiq::Job` alias for `Sidekiq::Worker`, to better
14
+ reflect industry standard terminology. You can now do this:
15
+ ```ruby
16
+ class MyJob
17
+ include Sidekiq::Job
18
+ sidekiq_options ...
19
+ def perform(args)
20
+ end
21
+ end
22
+ ```
23
+ - **FEATURE**: Support for serializing ActiveSupport::CurrentAttributes into each job. [#4982]
24
+ ```ruby
25
+ # config/initializers/sidekiq.rb
26
+ require "sidekiq/middleware/current_attributes"
27
+ Sidekiq::CurrentAttributes.persist(Myapp::Current) # Your AS::CurrentAttributes singleton
28
+ ```
29
+ - **FEATURE**: Add `Sidekiq::Worker.perform_bulk` for enqueuing jobs in bulk,
30
+ similar to `Sidekiq::Client.push_bulk` [#5042]
31
+ ```ruby
32
+ MyJob.perform_bulk([[1], [2], [3]])
33
+ ```
34
+ - Implement `queue_as`, `wait` and `wait_until` for ActiveJob compatibility [#5003]
35
+ - Scheduler now uses Lua to reduce Redis load and network roundtrips [#5044]
36
+ - Retry Redis operation if we get an `UNBLOCKED` Redis error [#4985]
37
+ - Run existing signal traps, if any, before running Sidekiq's trap [#4991]
38
+ - Fix fetch bug when using weighted queues which caused Sidekiq to stop
39
+ processing queues randomly [#5031]
40
+
41
+ 6.2.2
42
+ ---------
43
+
44
+ - Reduce retry jitter, add jitter to `sidekiq_retry_in` values [#4957]
45
+ - Minimize scheduler load on Redis at scale [#4882]
46
+ - Improve logging of delay jobs [#4904, BuonOno]
47
+ - Minor CSS improvements for buttons and tables, design PRs always welcome!
48
+ - Tweak Web UI `Cache-Control` header [#4966]
49
+ - Rename internal API class `Sidekiq::Job` to `Sidekiq::JobRecord` [#4955]
50
+
51
+ 6.2.1
52
+ ---------
53
+
54
+ - Update RTT warning logic to handle transient RTT spikes [#4851]
55
+ - Fix very low priority CVE on unescaped queue name [#4852]
56
+ - Add note about sessions and Rails apps in API mode
57
+
58
+ 6.2.0
59
+ ---------
60
+
61
+ - Store Redis RTT and log if poor [#4824]
62
+ - Add process/thread stats to Busy page [#4806]
63
+ - Improve Web UI on mobile devices [#4840]
64
+ - **Refactor Web UI session usage** [#4804]
65
+ Numerous people have hit "Forbidden" errors and struggled with Sidekiq's
66
+ Web UI session requirement. If you have code in your initializer for
67
+ Web sessions, it's quite possible it will need to be removed. Here's
68
+ an overview:
69
+ ```
70
+ Sidekiq::Web needs a valid Rack session for CSRF protection. If this is a Rails app,
71
+ make sure you mount Sidekiq::Web *inside* your routes in `config/routes.rb` so
72
+ Sidekiq can reuse the Rails session:
73
+
74
+ Rails.application.routes.draw do
75
+ mount Sidekiq::Web => "/sidekiq"
76
+ ....
77
+ end
78
+
79
+ If this is a bare Rack app, use a session middleware before Sidekiq::Web:
80
+
81
+ # first, use IRB to create a shared secret key for sessions and commit it
82
+ require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) }
83
+
84
+ # now, update your Rack app to include the secret with a session cookie middleware
85
+ use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
86
+ run Sidekiq::Web
87
+
88
+ If this is a Rails app in API mode, you need to enable sessions.
89
+
90
+ https://guides.rubyonrails.org/api_app.html#using-session-middlewares
91
+ ```
92
+
93
+ 6.1.3
94
+ ---------
95
+
96
+ - Warn if Redis is configured to evict data under memory pressure [#4752]
97
+ - Add process RSS on the Busy page [#4717]
98
+
99
+ 6.1.2
100
+ ---------
101
+
102
+ - Improve readability in dark mode Web UI [#4674]
103
+ - Fix Web UI crash with corrupt session [#4672]
104
+ - Allow middleware to yield arguments [#4673, @eugeneius]
105
+ - Migrate CI from CircleCI to GitHub Actions [#4677]
106
+
107
+ 6.1.1
108
+ ---------
109
+
110
+ - Jobs are now sorted by age in the Busy Workers table. [#4641]
111
+ - Fix "check all" JS logic in Web UI [#4619]
112
+
113
+ 6.1.0
114
+ ---------
115
+
116
+ - Web UI - Dark Mode fixes [#4543, natematykiewicz]
117
+ - Ensure `Rack::ContentLength` is loaded as middleware for correct Web UI responses [#4541]
118
+ - Avoid exception dumping SSL store in Redis connection logging [#4532]
119
+ - Better error messages in Sidekiq::Client [#4549]
120
+ - Remove rack-protection, reimplement CSRF protection [#4588]
121
+ - Require redis-rb 4.2 [#4591]
122
+ - Update to jquery 1.12.4 [#4593]
123
+ - Refactor internal fetch logic and API [#4602]
124
+
125
+ 6.0.7
126
+ ---------
127
+
128
+ - Refactor systemd integration to work better with custom binaries [#4511]
129
+ - Don't connect to Redis at process exit if not needed [#4502]
130
+ - Remove Redis connection naming [#4479]
131
+ - Fix Redis Sentinel password redaction [#4499]
132
+ - Add Vietnamese locale (vi) [#4528]
133
+
134
+ 6.0.6
135
+ ---------
136
+
137
+ - **Integrate with systemd's watchdog and notification features** [#4488]
138
+ Set `Type=notify` in [sidekiq.service](https://github.com/mperham/sidekiq/blob/4b8a8bd3ae42f6e48ae1fdaf95ed7d7af18ed8bb/examples/systemd/sidekiq.service#L30-L39). The integration works automatically.
139
+ - Use `setTimeout` rather than `setInterval` to avoid thundering herd [#4480]
140
+ - Fix edge case where a job can be pushed without a queue.
141
+ - Flush job stats at exit [#4498]
142
+ - Check RAILS_ENV before RACK_ENV [#4493]
143
+ - Add Lithuanian locale [#4476]
144
+
145
+ 6.0.5
146
+ ---------
147
+
148
+ - Fix broken Web UI response when using NewRelic and Rack 2.1.2+. [#4440]
149
+ - Update APIs to use `UNLINK`, not `DEL`. [#4449]
150
+ - Fix Ruby 2.7 warnings [#4412]
151
+ - Add support for `APP_ENV` [[95fa5d9]](https://github.com/mperham/sidekiq/commit/95fa5d90192148026e52ca2902f1b83c70858ce8)
152
+
153
+ 6.0.4
154
+ ---------
155
+
156
+ - Fix ActiveJob's `sidekiq_options` integration [#4404]
157
+ - Sidekiq Pro users will now see a Pause button next to each queue in
158
+ the Web UI, allowing them to pause queues manually [#4374, shayonj]
159
+ - Fix Sidekiq::Workers API unintentional change in 6.0.2 [#4387]
160
+
161
+
162
+ 6.0.3
163
+ ---------
164
+
165
+ - Fix `Sidekiq::Client.push_bulk` API which was erroneously putting
166
+ invalid `at` values in the job payloads [#4321]
167
+
168
+ 6.0.2
169
+ ---------
170
+
171
+ - Fix Sidekiq Enterprise's rolling restart functionality, broken by refactoring in 6.0.0. [#4334]
172
+ - More internal refactoring and performance tuning [fatkodima]
173
+
174
+ 6.0.1
175
+ ---------
176
+
177
+ - **Performance tuning**, Sidekiq should be 10-15% faster now [#4303, 4299,
178
+ 4269, fatkodima]
179
+ - **Dark Mode support in Web UI** (further design polish welcome!) [#4227, mperham,
180
+ fatkodima, silent-e]
181
+ - **Job-specific log levels**, allowing you to turn on debugging for
182
+ problematic workers. [fatkodima, #4287]
183
+ ```ruby
184
+ MyWorker.set(log_level: :debug).perform_async(...)
185
+ ```
186
+ - **Ad-hoc job tags**. You can tag your jobs with, e.g, subdomain, tenant, country,
187
+ locale, application, version, user/client, "alpha/beta/pro/ent", types of jobs,
188
+ teams/people responsible for jobs, additional metadata, etc.
189
+ Tags are shown on different pages with job listings. Sidekiq Pro users
190
+ can filter based on them [fatkodima, #4280]
191
+ ```ruby
192
+ class MyWorker
193
+ include Sidekiq::Worker
194
+ sidekiq_options tags: ['bank-ops', 'alpha']
195
+ ...
196
+ end
197
+ ```
198
+ - Fetch scheduled jobs in batches before pushing into specific queues.
199
+ This will decrease enqueueing time of scheduled jobs by a third. [fatkodima, #4273]
200
+ ```
201
+ ScheduledSet with 10,000 jobs
202
+ Before: 56.6 seconds
203
+ After: 39.2 seconds
204
+ ```
205
+ - Compress error backtraces before pushing into Redis, if you are
206
+ storing error backtraces, this will halve the size of your RetrySet
207
+ in Redis [fatkodima, #4272]
208
+ ```
209
+ RetrySet with 100,000 jobs
210
+ Before: 261 MB
211
+ After: 129 MB
212
+ ```
213
+ - Support display of ActiveJob 6.0 payloads in the Web UI [#4263]
214
+ - Add `SortedSet#scan` for pattern based scanning. For large sets this API will be **MUCH** faster
215
+ than standard iteration using each. [fatkodima, #4262]
216
+ ```ruby
217
+ Sidekiq::DeadSet.new.scan("UnreliableApi") do |job|
218
+ job.retry
219
+ end
220
+ ```
221
+ - Dramatically speed up SortedSet#find\_job(jid) by using Redis's ZSCAN
222
+ support, approx 10x faster. [fatkodima, #4259]
223
+ ```
224
+ zscan 0.179366 0.047727 0.227093 ( 1.161376)
225
+ enum 8.522311 0.419826 8.942137 ( 9.785079)
226
+ ```
227
+ - Respect rails' generators `test_framework` option and gracefully handle extra `worker` suffix on generator [fatkodima, #4256]
228
+ - Add ability to sort 'Enqueued' page on Web UI by position in the queue [fatkodima, #4248]
229
+ - Support `Client.push_bulk` with different delays [fatkodima, #4243]
230
+ ```ruby
231
+ Sidekiq::Client.push_bulk("class" => FooJob, "args" => [[1], [2]], "at" => [1.minute.from_now.to_f, 5.minutes.from_now.to_f])
232
+ ```
233
+ - Easier way to test enqueuing specific ActionMailer and ActiveRecord delayed jobs. Instead of manually
234
+ parsing embedded class, you can now test by fetching jobs for specific classes. [fatkodima, #4292]
235
+ ```ruby
236
+ assert_equal 1, Sidekiq::Extensions::DelayedMailer.jobs_for(FooMailer).size
237
+ ```
238
+ - Add `sidekiqmon` to gemspec executables [#4242]
239
+ - Gracefully handle `Sidekiq.logger = nil` [#4240]
240
+ - Inject Sidekiq::LogContext module if user-supplied logger does not include it [#4239]
4
241
 
5
242
  6.0
6
243
  ---------
7
244
 
8
245
  This release has major breaking changes. Read and test carefully in production.
9
246
 
10
- - ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
247
+ - With Rails 6.0.2+, ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
11
248
  features/internals like the retry subsystem. [#4213, pirj]
12
249
  ```ruby
13
250
  class MyJob < ActiveJob::Base
@@ -17,6 +254,13 @@ class MyJob < ActiveJob::Base
17
254
  end
18
255
  end
19
256
  ```
257
+ - Logging has been redesigned to allow for pluggable log formatters:
258
+ ```ruby
259
+ Sidekiq.configure_server do |config|
260
+ config.log_formatter = Sidekiq::Logger::Formatters::JSON.new
261
+ end
262
+ ```
263
+ See the [Logging wiki page](https://github.com/mperham/sidekiq/wiki/Logging) for more details.
20
264
  - **BREAKING CHANGE** Validate proper usage of the `REDIS_PROVIDER`
21
265
  variable. This variable is meant to hold the name of the environment
22
266
  variable which contains your Redis URL, so that you can switch Redis
@@ -36,6 +280,18 @@ end
36
280
  - Integrate the StandardRB code formatter to ensure consistent code
37
281
  styling. [#4114, gearnode]
38
282
 
283
+ 5.2.9
284
+ ---------
285
+
286
+ - Release Rack lock due to a cascade of CVEs. [#4566]
287
+ Pro-tip: don't lock Rack.
288
+
289
+ 5.2.8
290
+ ---------
291
+
292
+ - Lock to Rack 2.0.x to prevent future incompatibilities
293
+ - Fix invalid reference in `sidekiqctl`
294
+
39
295
  5.2.7
40
296
  ---------
41
297
 
data/LICENSE CHANGED
@@ -6,4 +6,4 @@ for license text.
6
6
 
7
7
  Sidekiq Pro has a commercial-friendly license allowing private forks
8
8
  and modifications of Sidekiq. Please see https://sidekiq.org/products/pro.html for
9
- more detail. You can find the commercial license terms in COMM-LICENSE.
9
+ more detail. You can find the commercial license terms in COMM-LICENSE.txt.
data/README.md CHANGED
@@ -2,10 +2,7 @@ Sidekiq
2
2
  ==============
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
5
- [![Code Climate](https://codeclimate.com/github/mperham/sidekiq.svg)](https://codeclimate.com/github/mperham/sidekiq)
6
- [![Build Status](https://circleci.com/gh/mperham/sidekiq/tree/master.svg?style=svg)](https://circleci.com/gh/mperham/sidekiq/tree/master)
7
- [![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.svg)](https://gitter.im/mperham/sidekiq)
8
-
5
+ ![Build](https://github.com/mperham/sidekiq/workflows/CI/badge.svg)
9
6
 
10
7
  Simple, efficient background processing for Ruby.
11
8
 
@@ -18,7 +15,8 @@ Performance
18
15
 
19
16
  Version | Latency | Garbage created for 10k jobs | Time to process 100k jobs | Throughput | Ruby
20
17
  -----------------|------|---------|---------|------------------------|-----
21
- Sidekiq 6.0.0 | 3 ms | 156 MB | 19 sec | **5200 jobs/sec** | MRI 2.6.3
18
+ Sidekiq 6.0.2 | 3 ms | 156 MB | 14.0 sec| **7100 jobs/sec** | MRI 2.6.3
19
+ Sidekiq 6.0.0 | 3 ms | 156 MB | 19 sec | 5200 jobs/sec | MRI 2.6.3
22
20
  Sidekiq 4.0.0 | 10 ms | 151 MB | 22 sec | 4500 jobs/sec |
23
21
  Sidekiq 3.5.1 | 22 ms | 1257 MB | 125 sec | 800 jobs/sec |
24
22
  Resque 1.25.2 | - | - | 420 sec | 240 jobs/sec |
@@ -48,7 +46,7 @@ See the [Getting Started wiki page](https://github.com/mperham/sidekiq/wiki/Gett
48
46
  You can watch [this Youtube playlist](https://www.youtube.com/playlist?list=PLjeHh2LSCFrWGT5uVjUuFKAcrcj5kSai1) to learn all about
49
47
  Sidekiq and see its features in action. Here's the Web UI:
50
48
 
51
- ![Web UI](https://github.com/mperham/sidekiq/raw/master/examples/web-ui.png)
49
+ ![Web UI](https://github.com/mperham/sidekiq/raw/main/examples/web-ui.png)
52
50
 
53
51
 
54
52
  Want to Upgrade?
@@ -86,10 +84,10 @@ See the [Sidekiq support page](https://sidekiq.org/support.html) for details.
86
84
  License
87
85
  -----------------
88
86
 
89
- Please see [LICENSE](https://github.com/mperham/sidekiq/blob/master/LICENSE) for licensing details.
87
+ Please see [LICENSE](https://github.com/mperham/sidekiq/blob/main/LICENSE) for licensing details.
90
88
 
91
89
 
92
90
  Author
93
91
  -----------------
94
92
 
95
- Mike Perham, [@mperham@mastodon.xyz](https://mastodon.xyz/@mperham) / [@sidekiq](https://twitter.com/sidekiq), [https://www.mikeperham.com](https://www.mikeperham.com) / [https://www.contribsys.com](https://www.contribsys.com)
93
+ Mike Perham, [@getajobmike](https://twitter.com/getajobmike) / [@sidekiq](https://twitter.com/sidekiq), [https://www.mikeperham.com](https://www.mikeperham.com) / [https://www.contribsys.com](https://www.contribsys.com)
data/bin/sidekiq CHANGED
@@ -6,13 +6,37 @@ $TESTING = false
6
6
 
7
7
  require_relative '../lib/sidekiq/cli'
8
8
 
9
+ def integrate_with_systemd
10
+ return unless ENV["NOTIFY_SOCKET"]
11
+
12
+ Sidekiq.configure_server do |config|
13
+ Sidekiq.logger.info "Enabling systemd notification integration"
14
+ require "sidekiq/sd_notify"
15
+ config.on(:startup) do
16
+ Sidekiq::SdNotify.ready
17
+ end
18
+ config.on(:shutdown) do
19
+ Sidekiq::SdNotify.stopping
20
+ end
21
+ Sidekiq.start_watchdog if Sidekiq::SdNotify.watchdog?
22
+ end
23
+ end
24
+
9
25
  begin
10
26
  cli = Sidekiq::CLI.instance
11
27
  cli.parse
28
+
29
+ integrate_with_systemd
30
+
12
31
  cli.run
13
32
  rescue => e
14
33
  raise e if $DEBUG
15
- STDERR.puts e.message
16
- STDERR.puts e.backtrace.join("\n")
34
+ if Sidekiq.error_handlers.length == 0
35
+ STDERR.puts e.message
36
+ STDERR.puts e.backtrace.join("\n")
37
+ else
38
+ cli.handle_exception e
39
+ end
40
+
17
41
  exit 1
18
42
  end
data/bin/sidekiqload CHANGED
@@ -5,7 +5,8 @@
5
5
  $TESTING = false
6
6
 
7
7
  #require 'ruby-prof'
8
- Bundler.require(:default)
8
+ require 'bundler/setup'
9
+ Bundler.require(:default, :load_test)
9
10
 
10
11
  require_relative '../lib/sidekiq/cli'
11
12
  require_relative '../lib/sidekiq/launcher'
@@ -102,17 +103,20 @@ iter.times do
102
103
  end
103
104
  Sidekiq.logger.error "Created #{count*iter} jobs"
104
105
 
106
+ start = Time.now
107
+
105
108
  Monitoring = Thread.new do
106
109
  watchdog("monitor thread") do
107
110
  while true
108
- sleep 0.5
111
+ sleep 0.2
109
112
  qsize = Sidekiq.redis do |conn|
110
113
  conn.llen "queue:default"
111
114
  end
112
115
  total = qsize
113
- Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
116
+ #Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
114
117
  if total == 0
115
- Sidekiq.logger.error("Done, now here's the latency for three jobs")
118
+ Sidekiq.logger.error("Done, #{iter * count} jobs in #{Time.now - start} sec")
119
+ Sidekiq.logger.error("Now here's the latency for three jobs")
116
120
 
117
121
  LoadWorker.perform_async(1, Time.now.to_f)
118
122
  LoadWorker.perform_async(2, Time.now.to_f)
data/bin/sidekiqmon CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  require 'sidekiq/monitor'
4
4
 
5
- if ARGV[0] == 'status'
6
- Sidekiq::Monitor::Status.new.display(ARGV[1])
7
- else
8
- Sidekiq::Monitor.print_usage
9
- end
5
+ section = "all"
6
+ section = ARGV[0] if ARGV.size == 1
7
+
8
+ Sidekiq::Monitor::Status.new.display(section)
@@ -16,7 +16,9 @@ module Sidekiq
16
16
  end
17
17
 
18
18
  def create_test_file
19
- if defined?(RSpec)
19
+ return unless test_framework
20
+
21
+ if test_framework == :rspec
20
22
  create_worker_spec
21
23
  else
22
24
  create_worker_test
@@ -42,6 +44,14 @@ module Sidekiq
42
44
  )
43
45
  template "worker_test.rb.erb", template_file
44
46
  end
47
+
48
+ def file_name
49
+ @_file_name ||= super.sub(/_?worker\z/i, "")
50
+ end
51
+
52
+ def test_framework
53
+ ::Rails.application.config.generators.options[:rails][:test_framework]
54
+ end
45
55
  end
46
56
  end
47
57
  end