sidekiq 6.2.2 → 6.4.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +76 -1
  3. data/LICENSE +3 -3
  4. data/README.md +8 -3
  5. data/bin/sidekiq +3 -3
  6. data/bin/sidekiqload +56 -58
  7. data/bin/sidekiqmon +1 -1
  8. data/lib/generators/sidekiq/job_generator.rb +57 -0
  9. data/lib/generators/sidekiq/templates/{worker.rb.erb → job.rb.erb} +2 -2
  10. data/lib/generators/sidekiq/templates/{worker_spec.rb.erb → job_spec.rb.erb} +1 -1
  11. data/lib/generators/sidekiq/templates/{worker_test.rb.erb → job_test.rb.erb} +1 -1
  12. data/lib/sidekiq/api.rb +50 -43
  13. data/lib/sidekiq/cli.rb +23 -5
  14. data/lib/sidekiq/client.rb +22 -41
  15. data/lib/sidekiq/delay.rb +2 -0
  16. data/lib/sidekiq/fetch.rb +6 -5
  17. data/lib/sidekiq/job.rb +8 -3
  18. data/lib/sidekiq/job_logger.rb +15 -27
  19. data/lib/sidekiq/job_retry.rb +6 -4
  20. data/lib/sidekiq/job_util.rb +65 -0
  21. data/lib/sidekiq/launcher.rb +32 -28
  22. data/lib/sidekiq/logger.rb +4 -0
  23. data/lib/sidekiq/manager.rb +7 -9
  24. data/lib/sidekiq/middleware/current_attributes.rb +57 -0
  25. data/lib/sidekiq/paginator.rb +8 -8
  26. data/lib/sidekiq/rails.rb +11 -0
  27. data/lib/sidekiq/redis_connection.rb +4 -6
  28. data/lib/sidekiq/scheduled.rb +44 -15
  29. data/lib/sidekiq/util.rb +13 -0
  30. data/lib/sidekiq/version.rb +1 -1
  31. data/lib/sidekiq/web/application.rb +7 -4
  32. data/lib/sidekiq/web/helpers.rb +2 -13
  33. data/lib/sidekiq/web.rb +3 -3
  34. data/lib/sidekiq/worker.rb +125 -7
  35. data/lib/sidekiq.rb +9 -1
  36. data/sidekiq.gemspec +1 -1
  37. data/web/assets/javascripts/application.js +82 -61
  38. data/web/assets/javascripts/dashboard.js +51 -51
  39. data/web/assets/stylesheets/application-dark.css +19 -23
  40. data/web/assets/stylesheets/application-rtl.css +0 -4
  41. data/web/assets/stylesheets/application.css +12 -108
  42. data/web/locales/en.yml +1 -1
  43. data/web/views/_footer.erb +1 -1
  44. data/web/views/_poll_link.erb +2 -5
  45. data/web/views/_summary.erb +7 -7
  46. data/web/views/dashboard.erb +8 -8
  47. data/web/views/layout.erb +1 -1
  48. data/web/views/queue.erb +10 -10
  49. data/web/views/queues.erb +1 -1
  50. metadata +10 -8
  51. data/lib/generators/sidekiq/worker_generator.rb +0 -57
@@ -9,7 +9,7 @@
9
9
  <p class="navbar-text redis-url" title="<%= redis_connection_and_namespace %>"><%= redis_connection_and_namespace %></p>
10
10
  </li>
11
11
  <li>
12
- <p class="navbar-text server-utc-time"><%= server_utc_time %></p>
12
+ <p id="serverUtcTime" class="navbar-text server-utc-time"><%= server_utc_time %></p>
13
13
  </li>
14
14
  <li>
15
15
  <p class="navbar-text"><a style="color: gray;" href="https://github.com/mperham/sidekiq/wiki">docs</a></p>
@@ -1,7 +1,4 @@
1
1
  <% if current_path != '' %>
2
- <% if params[:poll] %>
3
- <a id="live-poll" class="btn btn-primary active" href="<%= root_path + current_path %>"><%= t('StopPolling') %></a>
4
- <% else %>
5
- <a id="live-poll" class="btn btn-primary" href="<%= root_path + current_path %>?<%= qparams(poll: true) %>"><%= t('LivePoll') %></a>
6
- <% end %>
2
+ <a class="live-poll-start live-poll btn btn-primary"><%= t('LivePoll') %></a>
3
+ <a class="live-poll-stop live-poll btn btn-primary active"><%= t('StopPolling') %></a>
7
4
  <% end %>
@@ -1,39 +1,39 @@
1
1
  <ul class="list-unstyled summary row">
2
2
  <li class="processed col-sm-1">
3
- <span class="count"><%= number_with_delimiter(stats.processed) %></span>
3
+ <span id="txtProcessed" class="count"><%= number_with_delimiter(stats.processed) %></span>
4
4
  <span class="desc"><%= t('Processed') %></span>
5
5
  </li>
6
6
  <li class="failed col-sm-1">
7
- <span class="count"><%= number_with_delimiter(stats.failed) %></span>
7
+ <span id="txtFailed" class="count"><%= number_with_delimiter(stats.failed) %></span>
8
8
  <span class="desc"><%= t('Failed') %></span>
9
9
  </li>
10
10
  <li class="busy col-sm-1">
11
11
  <a href="<%= root_path %>busy">
12
- <span class="count"><%= number_with_delimiter(workers.size) %></span>
12
+ <span id="txtBusy" class="count"><%= number_with_delimiter(workers.size) %></span>
13
13
  <span class="desc"><%= t('Busy') %></span>
14
14
  </a>
15
15
  </li>
16
16
  <li class="enqueued col-sm-1">
17
17
  <a href="<%= root_path %>queues">
18
- <span class="count"><%= number_with_delimiter(stats.enqueued) %></span>
18
+ <span id="txtEnqueued" class="count"><%= number_with_delimiter(stats.enqueued) %></span>
19
19
  <span class="desc"><%= t('Enqueued') %></span>
20
20
  </a>
21
21
  </li>
22
22
  <li class="retries col-sm-1">
23
23
  <a href="<%= root_path %>retries">
24
- <span class="count"><%= number_with_delimiter(stats.retry_size) %></span>
24
+ <span id="txtRetries" class="count"><%= number_with_delimiter(stats.retry_size) %></span>
25
25
  <span class="desc"><%= t('Retries') %></span>
26
26
  </a>
27
27
  </li>
28
28
  <li class="scheduled col-sm-1">
29
29
  <a href="<%= root_path %>scheduled">
30
- <span class="count"><%= number_with_delimiter(stats.scheduled_size) %></span>
30
+ <span id="txtScheduled" class="count"><%= number_with_delimiter(stats.scheduled_size) %></span>
31
31
  <span class="desc"><%= t('Scheduled') %></span>
32
32
  </a>
33
33
  </li>
34
34
  <li class="dead col-sm-1">
35
35
  <a href="<%= root_path %>morgue">
36
- <span class="count"><%= number_with_delimiter(stats.dead_size) %></span>
36
+ <span id="txtDead" class="count"><%= number_with_delimiter(stats.dead_size) %></span>
37
37
  <span class="desc"><%= t('Dead') %></span>
38
38
  </a>
39
39
  </li>
@@ -2,16 +2,16 @@
2
2
  <div class= "dashboard clearfix">
3
3
  <h3 >
4
4
  <%= t('Dashboard') %>
5
- <span class="beacon">
5
+ <span id="beacon" class="beacon">
6
6
  <span class="ring"></span>
7
7
  <span class="dot"></span>
8
8
  </span>
9
9
  </h3>
10
10
  <div class="interval-slider ltr">
11
11
  <span class="interval-slider-label"><%= t('PollingInterval') %>:</span>
12
- <span class="current-interval">5 sec</span>
12
+ <span id="sldr-text" class="current-interval">5 sec</span>
13
13
  <br/>
14
- <input type="range" min="2000" max="20000" step="1000" value="5000"/>
14
+ <input id="sldr" type="range" min="2000" max="20000" step="1000" value="5000"/>
15
15
  </div>
16
16
  </div>
17
17
 
@@ -47,35 +47,35 @@
47
47
  <div class="stats-container">
48
48
  <% if @redis_info.fetch("redis_version", nil) %>
49
49
  <div class="stat">
50
- <h3 class="redis_version"><%= @redis_info.fetch("redis_version") %></h3>
50
+ <h3 id="redis_version"><%= @redis_info.fetch("redis_version") %></h3>
51
51
  <p><%= t('Version') %></p>
52
52
  </div>
53
53
  <% end %>
54
54
 
55
55
  <% if @redis_info.fetch("uptime_in_days", nil) %>
56
56
  <div class="stat">
57
- <h3 class="uptime_in_days"><%= @redis_info.fetch("uptime_in_days") %></h3>
57
+ <h3 id="uptime_in_days"><%= @redis_info.fetch("uptime_in_days") %></h3>
58
58
  <p><%= t('Uptime') %></p>
59
59
  </div>
60
60
  <% end %>
61
61
 
62
62
  <% if @redis_info.fetch("connected_clients", nil) %>
63
63
  <div class="stat">
64
- <h3 class="connected_clients"><%= @redis_info.fetch("connected_clients") %></h3>
64
+ <h3 id="connected_clients"><%= @redis_info.fetch("connected_clients") %></h3>
65
65
  <p><%= t('Connections') %></p>
66
66
  </div>
67
67
  <% end %>
68
68
 
69
69
  <% if @redis_info.fetch("used_memory_human", nil) %>
70
70
  <div class="stat">
71
- <h3 class="used_memory_human"><%= @redis_info.fetch("used_memory_human") %></h3>
71
+ <h3 id="used_memory_human"><%= @redis_info.fetch("used_memory_human") %></h3>
72
72
  <p><%= t('MemoryUsage') %></p>
73
73
  </div>
74
74
  <% end %>
75
75
 
76
76
  <% if @redis_info.fetch("used_memory_peak_human", nil) %>
77
77
  <div class="stat">
78
- <h3 class="used_memory_peak_human"><%= @redis_info.fetch("used_memory_peak_human") %></h3>
78
+ <h3 id="used_memory_peak_human"><%= @redis_info.fetch("used_memory_peak_human") %></h3>
79
79
  <p><%= t('PeakMemoryUsage') %></p>
80
80
  </div>
81
81
  <% end %>
data/web/views/layout.erb CHANGED
@@ -22,7 +22,7 @@
22
22
  <meta name="google" content="notranslate" />
23
23
  <%= display_custom_head %>
24
24
  </head>
25
- <body class="admin" data-poll-path="<%= poll_path %>" data-locale="<%= locale %>">
25
+ <body class="admin" data-locale="<%= locale %>">
26
26
  <%= erb :_nav %>
27
27
  <div id="page">
28
28
  <div class="container">
data/web/views/queue.erb CHANGED
@@ -20,31 +20,31 @@
20
20
  <th><%= t('Arguments') %></th>
21
21
  <th></th>
22
22
  </thead>
23
- <% @messages.each_with_index do |msg, index| %>
24
- <tr>
23
+ <% @jobs.each_with_index do |job, index| %>
24
+ <tr title="<%= job.jid %>">
25
25
  <% if params[:direction] == 'asc' %>
26
26
  <td><%= @count * (@current_page - 1) + index + 1 %></td>
27
27
  <% else %>
28
28
  <td><%= @total_size - (@count * (@current_page - 1) + index) %></td>
29
29
  <% end %>
30
30
  <td>
31
- <%= h(msg.display_class) %>
32
- <%= display_tags(msg, nil) %>
31
+ <%= h(job.display_class) %>
32
+ <%= display_tags(job, nil) %>
33
33
  </td>
34
34
  <td>
35
- <% a = msg.display_args %>
35
+ <% a = job.display_args %>
36
36
  <% if a.inspect.size > 100 %>
37
- <span class="worker_<%= index %>"><%= h(a.inspect[0..100]) + "... " %></span>
38
- <button data-toggle="collapse" data-target=".worker_<%= index %>" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
39
- <div class="toggle worker_<%= index %>"><%= display_args(a) %></div>
37
+ <span id="job_<%= index %>"><%= h(a.inspect[0..100]) + "... " %></span>
38
+ <button data-toggle="job_<%= index %>" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
39
+ <div class="toggle" id="job_<%= index %>_full"><%= display_args(a) %></div>
40
40
  <% else %>
41
- <%= display_args(msg.display_args) %>
41
+ <%= display_args(job.display_args) %>
42
42
  <% end %>
43
43
  </td>
44
44
  <td>
45
45
  <form action="<%= root_path %>queues/<%= CGI.escape(@name) %>/delete" method="post">
46
46
  <%= csrf_tag %>
47
- <input name="key_val" value="<%= h msg.value %>" type="hidden" />
47
+ <input name="key_val" value="<%= h job.value %>" type="hidden" />
48
48
  <input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
49
49
  </form>
50
50
  </td>
data/web/views/queues.erb CHANGED
@@ -21,7 +21,7 @@
21
21
  <td class="delete-confirm">
22
22
  <form action="<%=root_path %>queues/<%= CGI.escape(queue.name) %>" method="post">
23
23
  <%= csrf_tag %>
24
- <input class="btn btn-danger" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => h(queue.name)) %>" />
24
+ <input class="btn btn-danger" type="submit" name="delete" title="This will delete all jobs within the queue, it will reappear if you push more jobs to it in the future." value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => h(queue.name)) %>" />
25
25
 
26
26
  <% if Sidekiq.pro? %>
27
27
  <% if queue.paused? %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.2
4
+ version: 6.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -67,10 +67,10 @@ files:
67
67
  - bin/sidekiq
68
68
  - bin/sidekiqload
69
69
  - bin/sidekiqmon
70
- - lib/generators/sidekiq/templates/worker.rb.erb
71
- - lib/generators/sidekiq/templates/worker_spec.rb.erb
72
- - lib/generators/sidekiq/templates/worker_test.rb.erb
73
- - lib/generators/sidekiq/worker_generator.rb
70
+ - lib/generators/sidekiq/job_generator.rb
71
+ - lib/generators/sidekiq/templates/job.rb.erb
72
+ - lib/generators/sidekiq/templates/job_spec.rb.erb
73
+ - lib/generators/sidekiq/templates/job_test.rb.erb
74
74
  - lib/sidekiq.rb
75
75
  - lib/sidekiq/api.rb
76
76
  - lib/sidekiq/cli.rb
@@ -85,10 +85,12 @@ files:
85
85
  - lib/sidekiq/job.rb
86
86
  - lib/sidekiq/job_logger.rb
87
87
  - lib/sidekiq/job_retry.rb
88
+ - lib/sidekiq/job_util.rb
88
89
  - lib/sidekiq/launcher.rb
89
90
  - lib/sidekiq/logger.rb
90
91
  - lib/sidekiq/manager.rb
91
92
  - lib/sidekiq/middleware/chain.rb
93
+ - lib/sidekiq/middleware/current_attributes.rb
92
94
  - lib/sidekiq/middleware/i18n.rb
93
95
  - lib/sidekiq/monitor.rb
94
96
  - lib/sidekiq/paginator.rb
@@ -174,7 +176,7 @@ metadata:
174
176
  homepage_uri: https://sidekiq.org
175
177
  bug_tracker_uri: https://github.com/mperham/sidekiq/issues
176
178
  documentation_uri: https://github.com/mperham/sidekiq/wiki
177
- changelog_uri: https://github.com/mperham/sidekiq/blob/master/Changes.md
179
+ changelog_uri: https://github.com/mperham/sidekiq/blob/main/Changes.md
178
180
  source_code_uri: https://github.com/mperham/sidekiq
179
181
  post_install_message:
180
182
  rdoc_options: []
@@ -191,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
193
  - !ruby/object:Gem::Version
192
194
  version: '0'
193
195
  requirements: []
194
- rubygems_version: 3.1.4
196
+ rubygems_version: 3.2.32
195
197
  signing_key:
196
198
  specification_version: 4
197
199
  summary: Simple, efficient background processing for Ruby
@@ -1,57 +0,0 @@
1
- require "rails/generators/named_base"
2
-
3
- module Sidekiq
4
- module Generators # :nodoc:
5
- class WorkerGenerator < ::Rails::Generators::NamedBase # :nodoc:
6
- desc "This generator creates a Sidekiq Worker in app/workers and a corresponding test"
7
-
8
- check_class_collision suffix: "Worker"
9
-
10
- def self.default_generator_root
11
- File.dirname(__FILE__)
12
- end
13
-
14
- def create_worker_file
15
- template "worker.rb.erb", File.join("app/workers", class_path, "#{file_name}_worker.rb")
16
- end
17
-
18
- def create_test_file
19
- return unless test_framework
20
-
21
- if test_framework == :rspec
22
- create_worker_spec
23
- else
24
- create_worker_test
25
- end
26
- end
27
-
28
- private
29
-
30
- def create_worker_spec
31
- template_file = File.join(
32
- "spec/workers",
33
- class_path,
34
- "#{file_name}_worker_spec.rb"
35
- )
36
- template "worker_spec.rb.erb", template_file
37
- end
38
-
39
- def create_worker_test
40
- template_file = File.join(
41
- "test/workers",
42
- class_path,
43
- "#{file_name}_worker_test.rb"
44
- )
45
- template "worker_test.rb.erb", template_file
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
55
- end
56
- end
57
- end