sidekiq 8.0.10 → 8.1.3

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +58 -0
  3. data/README.md +16 -1
  4. data/bin/kiq +17 -0
  5. data/bin/lint-herb +13 -0
  6. data/lib/active_job/queue_adapters/sidekiq_adapter.rb +11 -8
  7. data/lib/generators/sidekiq/job_generator.rb +15 -3
  8. data/lib/sidekiq/api.rb +130 -76
  9. data/lib/sidekiq/capsule.rb +0 -1
  10. data/lib/sidekiq/cli.rb +2 -1
  11. data/lib/sidekiq/client.rb +3 -1
  12. data/lib/sidekiq/component.rb +3 -0
  13. data/lib/sidekiq/config.rb +4 -5
  14. data/lib/sidekiq/job.rb +2 -0
  15. data/lib/sidekiq/job_retry.rb +7 -3
  16. data/lib/sidekiq/launcher.rb +5 -5
  17. data/lib/sidekiq/manager.rb +1 -1
  18. data/lib/sidekiq/paginator.rb +6 -1
  19. data/lib/sidekiq/profiler.rb +1 -1
  20. data/lib/sidekiq/scheduled.rb +6 -7
  21. data/lib/sidekiq/test_api.rb +331 -0
  22. data/lib/sidekiq/testing/inline.rb +2 -30
  23. data/lib/sidekiq/testing.rb +2 -334
  24. data/lib/sidekiq/tui/controls.rb +53 -0
  25. data/lib/sidekiq/tui/filtering.rb +53 -0
  26. data/lib/sidekiq/tui/tabs/base_tab.rb +187 -0
  27. data/lib/sidekiq/tui/tabs/busy.rb +118 -0
  28. data/lib/sidekiq/tui/tabs/dead.rb +19 -0
  29. data/lib/sidekiq/tui/tabs/home.rb +144 -0
  30. data/lib/sidekiq/tui/tabs/metrics.rb +131 -0
  31. data/lib/sidekiq/tui/tabs/queues.rb +95 -0
  32. data/lib/sidekiq/tui/tabs/retries.rb +19 -0
  33. data/lib/sidekiq/tui/tabs/scheduled.rb +19 -0
  34. data/lib/sidekiq/tui/tabs/set_tab.rb +96 -0
  35. data/lib/sidekiq/tui/tabs.rb +15 -0
  36. data/lib/sidekiq/tui.rb +380 -0
  37. data/lib/sidekiq/version.rb +1 -1
  38. data/lib/sidekiq/web/action.rb +1 -1
  39. data/lib/sidekiq/web/application.rb +2 -2
  40. data/lib/sidekiq/web/config.rb +3 -6
  41. data/lib/sidekiq/web/helpers.rb +43 -3
  42. data/lib/sidekiq/web.rb +23 -4
  43. data/lib/sidekiq.rb +7 -0
  44. data/sidekiq.gemspec +6 -6
  45. data/web/assets/javascripts/application.js +1 -1
  46. data/web/assets/stylesheets/style.css +2 -2
  47. data/web/locales/ar.yml +1 -1
  48. data/web/locales/fa.yml +1 -1
  49. data/web/locales/gd.yml +1 -1
  50. data/web/locales/he.yml +1 -1
  51. data/web/locales/pt-BR.yml +1 -1
  52. data/web/locales/ur.yml +1 -1
  53. data/web/locales/zh-TW.yml +1 -1
  54. data/web/views/{_paging.erb → _paging.html.erb} +1 -1
  55. data/web/views/{busy.erb → busy.html.erb} +1 -1
  56. data/web/views/{metrics.erb → metrics.html.erb} +3 -2
  57. metadata +51 -35
  58. data/lib/sidekiq/web/csrf_protection.rb +0 -183
  59. /data/web/views/{_footer.erb → _footer.html.erb} +0 -0
  60. /data/web/views/{_job_info.erb → _job_info.html.erb} +0 -0
  61. /data/web/views/{_metrics_period_select.erb → _metrics_period_select.html.erb} +0 -0
  62. /data/web/views/{_nav.erb → _nav.html.erb} +0 -0
  63. /data/web/views/{_poll_link.erb → _poll_link.html.erb} +0 -0
  64. /data/web/views/{_summary.erb → _summary.html.erb} +0 -0
  65. /data/web/views/{dashboard.erb → dashboard.html.erb} +0 -0
  66. /data/web/views/{dead.erb → dead.html.erb} +0 -0
  67. /data/web/views/{filtering.erb → filtering.html.erb} +0 -0
  68. /data/web/views/{layout.erb → layout.html.erb} +0 -0
  69. /data/web/views/{metrics_for_job.erb → metrics_for_job.html.erb} +0 -0
  70. /data/web/views/{morgue.erb → morgue.html.erb} +0 -0
  71. /data/web/views/{profiles.erb → profiles.html.erb} +0 -0
  72. /data/web/views/{queue.erb → queue.html.erb} +0 -0
  73. /data/web/views/{queues.erb → queues.html.erb} +0 -0
  74. /data/web/views/{retries.erb → retries.html.erb} +0 -0
  75. /data/web/views/{retry.erb → retry.html.erb} +0 -0
  76. /data/web/views/{scheduled.erb → scheduled.html.erb} +0 -0
  77. /data/web/views/{scheduled_job_info.erb → scheduled_job_info.html.erb} +0 -0
@@ -1,4 +1,4 @@
1
- "pt-BR":
1
+ pt-BR:
2
2
  LanguageName: Português (Brasil)
3
3
  Actions: Ações
4
4
  AddToQueue: Adicionar à fila
data/web/locales/ur.yml CHANGED
@@ -69,7 +69,7 @@ ur:
69
69
  Stop: بند کرو
70
70
  StopAll: ﺗﻤﺎﻡ ﺑﻨﺪ کﺭﻭ
71
71
  StopPolling: ﺑﺮاﮦ ﺭاﺳﺖ روکيے
72
- TextDirection: 'rtl'
72
+ TextDirection: rtl
73
73
  Thread: موضوع
74
74
  Threads: موضوع
75
75
  ThreeMonths: تین ماہ
@@ -1,6 +1,6 @@
1
1
  # elements like %{queue} are variables and should not be translated
2
2
  zh-TW: # <---- change this to your locale code
3
- LanguageName: 臺灣話
3
+ LanguageName: 繁體中文
4
4
  Dashboard: 資訊主頁
5
5
  Status: 狀態
6
6
  Time: 時間
@@ -10,7 +10,7 @@
10
10
  <a href="<%= url %>?<%= qparams(page: @current_page - 1) %>"><%= @current_page - 1 %></a>
11
11
  </li>
12
12
  <% end %>
13
- <li class="disabled">
13
+ <li class="active">
14
14
  <a href="<%= url %>?<%= qparams(page: @current_page) %>"><%= @current_page %></a>
15
15
  </li>
16
16
  <% if @total_size > @current_page * @count %>
@@ -69,7 +69,7 @@
69
69
  <% end %>
70
70
  <br>
71
71
  <b><%= "#{t('Queues')}: " %></b>
72
- <%= process.queues.sort.join(", ") %>
72
+ <%= queue_names_by_capsule(process) %>
73
73
  <% if process.version != Sidekiq::VERSION %>
74
74
  <br>
75
75
  <b><%= "#{t('Version')}: " %></b>
@@ -58,8 +58,9 @@
58
58
  id="<%= id %>"
59
59
  class="metrics-swatch"
60
60
  value="<%= kls %>"
61
- <%= visible_kls.include?(kls) ? 'checked' : '' %>
62
- >
61
+ <% if visible_kls.include?(kls) %>
62
+ checked
63
+ <% end %>>
63
64
  <code><a href="<%= root_path %>metrics/<%= kls %>?period=<%= @period %>"><%= kls %></a></code>
64
65
  </div>
65
66
  </td>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.10
4
+ version: 8.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
@@ -15,74 +15,75 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 0.23.2
18
+ version: 0.26.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.23.2
25
+ version: 0.26.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: connection_pool
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 2.5.0
32
+ version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 2.5.0
39
+ version: 3.0.0
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rack
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 3.1.0
46
+ version: 3.2.0
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 3.1.0
53
+ version: 3.2.0
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: json
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 2.9.0
60
+ version: 2.16.0
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 2.9.0
67
+ version: 2.16.0
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: logger
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 1.6.2
74
+ version: 1.7.0
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: 1.6.2
81
+ version: 1.7.0
82
82
  description: Simple, efficient background processing for Ruby.
83
83
  email:
84
84
  - info@contribsys.com
85
85
  executables:
86
+ - kiq
86
87
  - sidekiq
87
88
  - sidekiqmon
88
89
  extensions: []
@@ -91,6 +92,8 @@ files:
91
92
  - Changes.md
92
93
  - LICENSE.txt
93
94
  - README.md
95
+ - bin/kiq
96
+ - bin/lint-herb
94
97
  - bin/multi_queue_bench
95
98
  - bin/sidekiq
96
99
  - bin/sidekiqload
@@ -143,15 +146,28 @@ files:
143
146
  - lib/sidekiq/scheduled.rb
144
147
  - lib/sidekiq/sd_notify.rb
145
148
  - lib/sidekiq/systemd.rb
149
+ - lib/sidekiq/test_api.rb
146
150
  - lib/sidekiq/testing.rb
147
151
  - lib/sidekiq/testing/inline.rb
148
152
  - lib/sidekiq/transaction_aware_client.rb
153
+ - lib/sidekiq/tui.rb
154
+ - lib/sidekiq/tui/controls.rb
155
+ - lib/sidekiq/tui/filtering.rb
156
+ - lib/sidekiq/tui/tabs.rb
157
+ - lib/sidekiq/tui/tabs/base_tab.rb
158
+ - lib/sidekiq/tui/tabs/busy.rb
159
+ - lib/sidekiq/tui/tabs/dead.rb
160
+ - lib/sidekiq/tui/tabs/home.rb
161
+ - lib/sidekiq/tui/tabs/metrics.rb
162
+ - lib/sidekiq/tui/tabs/queues.rb
163
+ - lib/sidekiq/tui/tabs/retries.rb
164
+ - lib/sidekiq/tui/tabs/scheduled.rb
165
+ - lib/sidekiq/tui/tabs/set_tab.rb
149
166
  - lib/sidekiq/version.rb
150
167
  - lib/sidekiq/web.rb
151
168
  - lib/sidekiq/web/action.rb
152
169
  - lib/sidekiq/web/application.rb
153
170
  - lib/sidekiq/web/config.rb
154
- - lib/sidekiq/web/csrf_protection.rb
155
171
  - lib/sidekiq/web/helpers.rb
156
172
  - lib/sidekiq/web/router.rb
157
173
  - lib/sidekiq/worker_compatibility_alias.rb
@@ -199,28 +215,28 @@ files:
199
215
  - web/locales/vi.yml
200
216
  - web/locales/zh-CN.yml
201
217
  - web/locales/zh-TW.yml
202
- - web/views/_footer.erb
203
- - web/views/_job_info.erb
204
- - web/views/_metrics_period_select.erb
205
- - web/views/_nav.erb
206
- - web/views/_paging.erb
207
- - web/views/_poll_link.erb
208
- - web/views/_summary.erb
209
- - web/views/busy.erb
210
- - web/views/dashboard.erb
211
- - web/views/dead.erb
212
- - web/views/filtering.erb
213
- - web/views/layout.erb
214
- - web/views/metrics.erb
215
- - web/views/metrics_for_job.erb
216
- - web/views/morgue.erb
217
- - web/views/profiles.erb
218
- - web/views/queue.erb
219
- - web/views/queues.erb
220
- - web/views/retries.erb
221
- - web/views/retry.erb
222
- - web/views/scheduled.erb
223
- - web/views/scheduled_job_info.erb
218
+ - web/views/_footer.html.erb
219
+ - web/views/_job_info.html.erb
220
+ - web/views/_metrics_period_select.html.erb
221
+ - web/views/_nav.html.erb
222
+ - web/views/_paging.html.erb
223
+ - web/views/_poll_link.html.erb
224
+ - web/views/_summary.html.erb
225
+ - web/views/busy.html.erb
226
+ - web/views/dashboard.html.erb
227
+ - web/views/dead.html.erb
228
+ - web/views/filtering.html.erb
229
+ - web/views/layout.html.erb
230
+ - web/views/metrics.html.erb
231
+ - web/views/metrics_for_job.html.erb
232
+ - web/views/morgue.html.erb
233
+ - web/views/profiles.html.erb
234
+ - web/views/queue.html.erb
235
+ - web/views/queues.html.erb
236
+ - web/views/retries.html.erb
237
+ - web/views/retry.html.erb
238
+ - web/views/scheduled.html.erb
239
+ - web/views/scheduled_job_info.html.erb
224
240
  homepage: https://sidekiq.org
225
241
  licenses:
226
242
  - LGPL-3.0
@@ -245,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
261
  - !ruby/object:Gem::Version
246
262
  version: '0'
247
263
  requirements: []
248
- rubygems_version: 3.6.9
264
+ rubygems_version: 4.0.6
249
265
  specification_version: 4
250
266
  summary: Simple, efficient background processing for Ruby
251
267
  test_files: []
@@ -1,183 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # this file originally based on authenticity_token.rb from the sinatra/rack-protection project
4
- #
5
- # The MIT License (MIT)
6
- #
7
- # Copyright (c) 2011-2017 Konstantin Haase
8
- # Copyright (c) 2015-2017 Zachary Scott
9
- #
10
- # Permission is hereby granted, free of charge, to any person obtaining
11
- # a copy of this software and associated documentation files (the
12
- # 'Software'), to deal in the Software without restriction, including
13
- # without limitation the rights to use, copy, modify, merge, publish,
14
- # distribute, sublicense, and/or sell copies of the Software, and to
15
- # permit persons to whom the Software is furnished to do so, subject to
16
- # the following conditions:
17
- #
18
- # The above copyright notice and this permission notice shall be
19
- # included in all copies or substantial portions of the Software.
20
- #
21
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
22
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
-
29
- require "securerandom"
30
- require "rack/request"
31
-
32
- module Sidekiq
33
- class Web
34
- class CsrfProtection
35
- def initialize(app, options = nil)
36
- @app = app
37
- end
38
-
39
- def call(env)
40
- accept?(env) ? admit(env) : deny(env)
41
- end
42
-
43
- private
44
-
45
- def admit(env)
46
- # On each successful request, we create a fresh masked token
47
- # which will be used in any forms rendered for this request.
48
- s = session(env)
49
- s[:csrf] ||= SecureRandom.base64(TOKEN_LENGTH)
50
- env[:csrf_token] = mask_token(s[:csrf])
51
- @app.call(env)
52
- end
53
-
54
- def safe?(env)
55
- %w[GET HEAD OPTIONS TRACE].include? env["REQUEST_METHOD"]
56
- end
57
-
58
- def logger(env)
59
- @logger ||= env["rack.logger"] || ::Logger.new(env["rack.errors"])
60
- end
61
-
62
- def deny(env)
63
- logger(env).warn "attack prevented by #{self.class}"
64
- [403, {Rack::CONTENT_TYPE => "text/plain"}, ["Forbidden"]]
65
- end
66
-
67
- def session(env)
68
- env["rack.session"] || fail(<<~EOM)
69
- Sidekiq::Web needs a valid Rack session for CSRF protection. If this is a Rails app,
70
- make sure you mount Sidekiq::Web *inside* your application routes:
71
-
72
-
73
- Rails.application.routes.draw do
74
- mount Sidekiq::Web => "/sidekiq"
75
- ....
76
- end
77
-
78
-
79
- If this is a Rails app in API mode, you need to enable sessions.
80
-
81
- https://guides.rubyonrails.org/api_app.html#using-session-middlewares
82
-
83
- If this is a bare Rack app, use a session middleware before Sidekiq::Web:
84
-
85
- # first, use IRB to create a shared secret key for sessions and commit it
86
- require 'securerandom'; File.open(".session.key", "w") {|f| f.write(SecureRandom.hex(32)) }
87
-
88
- # now use the secret with a session cookie middleware
89
- use Rack::Session::Cookie, secret: File.read(".session.key"), same_site: true, max_age: 86400
90
- run Sidekiq::Web
91
-
92
- EOM
93
- end
94
-
95
- def accept?(env)
96
- return true if safe?(env)
97
-
98
- giventoken = ::Rack::Request.new(env).params["authenticity_token"]
99
- valid_token?(env, giventoken)
100
- end
101
-
102
- TOKEN_LENGTH = 32
103
-
104
- # Checks that the token given to us as a parameter matches
105
- # the token stored in the session.
106
- def valid_token?(env, giventoken)
107
- return false if giventoken.nil? || giventoken.empty?
108
-
109
- begin
110
- token = decode_token(giventoken)
111
- rescue ArgumentError # client input is invalid
112
- return false
113
- end
114
-
115
- sess = session(env)
116
- localtoken = sess[:csrf]
117
-
118
- # Checks that Rack::Session::Cookie actually contains the csrf token
119
- return false if localtoken.nil?
120
-
121
- # Rotate the session token after every use
122
- sess[:csrf] = SecureRandom.base64(TOKEN_LENGTH)
123
-
124
- # See if it's actually a masked token or not. We should be able
125
- # to handle any unmasked tokens that we've issued without error.
126
-
127
- if unmasked_token?(token)
128
- compare_with_real_token token, localtoken
129
- elsif masked_token?(token)
130
- unmasked = unmask_token(token)
131
- compare_with_real_token unmasked, localtoken
132
- else
133
- false # Token is malformed
134
- end
135
- end
136
-
137
- # Creates a masked version of the authenticity token that varies
138
- # on each request. The masking is used to mitigate SSL attacks
139
- # like BREACH.
140
- def mask_token(token)
141
- token = decode_token(token)
142
- one_time_pad = SecureRandom.random_bytes(token.length)
143
- encrypted_token = xor_byte_strings(one_time_pad, token)
144
- masked_token = one_time_pad + encrypted_token
145
- encode_token(masked_token)
146
- end
147
-
148
- # Essentially the inverse of +mask_token+.
149
- def unmask_token(masked_token)
150
- # Split the token into the one-time pad and the encrypted
151
- # value and decrypt it
152
- token_length = masked_token.length / 2
153
- one_time_pad = masked_token[0...token_length]
154
- encrypted_token = masked_token[token_length..]
155
- xor_byte_strings(one_time_pad, encrypted_token)
156
- end
157
-
158
- def unmasked_token?(token)
159
- token.length == TOKEN_LENGTH
160
- end
161
-
162
- def masked_token?(token)
163
- token.length == TOKEN_LENGTH * 2
164
- end
165
-
166
- def compare_with_real_token(token, local)
167
- ::Rack::Utils.secure_compare(token.to_s, decode_token(local).to_s)
168
- end
169
-
170
- def encode_token(token)
171
- [token].pack("m0").tr("+/", "-_")
172
- end
173
-
174
- def decode_token(token)
175
- token.tr("-_", "+/").unpack1("m0")
176
- end
177
-
178
- def xor_byte_strings(s1, s2)
179
- s1.bytes.zip(s2.bytes).map { |(c1, c2)| c1 ^ c2 }.pack("c*")
180
- end
181
- end
182
- end
183
- end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes