sidekiq 6.5.12 → 7.0.6

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 (103) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +63 -22
  3. data/README.md +40 -32
  4. data/bin/sidekiq +3 -8
  5. data/bin/sidekiqload +186 -118
  6. data/bin/sidekiqmon +3 -0
  7. data/lib/sidekiq/api.rb +84 -121
  8. data/lib/sidekiq/capsule.rb +127 -0
  9. data/lib/sidekiq/cli.rb +55 -74
  10. data/lib/sidekiq/client.rb +29 -16
  11. data/lib/sidekiq/component.rb +3 -0
  12. data/lib/sidekiq/config.rb +270 -0
  13. data/lib/sidekiq/deploy.rb +62 -0
  14. data/lib/sidekiq/embedded.rb +61 -0
  15. data/lib/sidekiq/fetch.rb +11 -14
  16. data/lib/sidekiq/job.rb +375 -10
  17. data/lib/sidekiq/job_logger.rb +2 -2
  18. data/lib/sidekiq/job_retry.rb +9 -9
  19. data/lib/sidekiq/job_util.rb +48 -14
  20. data/lib/sidekiq/launcher.rb +64 -61
  21. data/lib/sidekiq/logger.rb +1 -26
  22. data/lib/sidekiq/manager.rb +9 -11
  23. data/lib/sidekiq/metrics/query.rb +2 -2
  24. data/lib/sidekiq/metrics/shared.rb +4 -3
  25. data/lib/sidekiq/metrics/tracking.rb +20 -18
  26. data/lib/sidekiq/middleware/chain.rb +19 -18
  27. data/lib/sidekiq/middleware/current_attributes.rb +8 -15
  28. data/lib/sidekiq/monitor.rb +16 -3
  29. data/lib/sidekiq/processor.rb +21 -27
  30. data/lib/sidekiq/rails.rb +13 -17
  31. data/lib/sidekiq/redis_client_adapter.rb +8 -47
  32. data/lib/sidekiq/redis_connection.rb +11 -111
  33. data/lib/sidekiq/scheduled.rb +20 -21
  34. data/lib/sidekiq/testing.rb +5 -33
  35. data/lib/sidekiq/transaction_aware_client.rb +4 -5
  36. data/lib/sidekiq/version.rb +2 -1
  37. data/lib/sidekiq/web/application.rb +21 -6
  38. data/lib/sidekiq/web/csrf_protection.rb +1 -1
  39. data/lib/sidekiq/web/helpers.rb +16 -15
  40. data/lib/sidekiq/web.rb +6 -17
  41. data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
  42. data/lib/sidekiq.rb +76 -274
  43. data/sidekiq.gemspec +20 -10
  44. data/web/assets/javascripts/application.js +18 -1
  45. data/web/assets/javascripts/base-charts.js +106 -0
  46. data/web/assets/javascripts/dashboard-charts.js +166 -0
  47. data/web/assets/javascripts/dashboard.js +3 -223
  48. data/web/assets/javascripts/metrics.js +117 -115
  49. data/web/assets/stylesheets/application-dark.css +4 -0
  50. data/web/assets/stylesheets/application-rtl.css +2 -91
  51. data/web/assets/stylesheets/application.css +23 -298
  52. data/web/locales/ar.yml +70 -70
  53. data/web/locales/cs.yml +62 -62
  54. data/web/locales/da.yml +60 -53
  55. data/web/locales/de.yml +65 -65
  56. data/web/locales/el.yml +2 -7
  57. data/web/locales/en.yml +76 -70
  58. data/web/locales/es.yml +68 -68
  59. data/web/locales/fa.yml +65 -65
  60. data/web/locales/fr.yml +67 -67
  61. data/web/locales/he.yml +65 -64
  62. data/web/locales/hi.yml +59 -59
  63. data/web/locales/it.yml +53 -53
  64. data/web/locales/ja.yml +64 -68
  65. data/web/locales/ko.yml +52 -52
  66. data/web/locales/lt.yml +66 -66
  67. data/web/locales/nb.yml +61 -61
  68. data/web/locales/nl.yml +52 -52
  69. data/web/locales/pl.yml +45 -45
  70. data/web/locales/pt-br.yml +59 -69
  71. data/web/locales/pt.yml +51 -51
  72. data/web/locales/ru.yml +67 -66
  73. data/web/locales/sv.yml +53 -53
  74. data/web/locales/ta.yml +60 -60
  75. data/web/locales/uk.yml +62 -61
  76. data/web/locales/ur.yml +64 -64
  77. data/web/locales/vi.yml +67 -67
  78. data/web/locales/zh-cn.yml +20 -18
  79. data/web/locales/zh-tw.yml +10 -1
  80. data/web/views/_footer.erb +5 -2
  81. data/web/views/_job_info.erb +18 -2
  82. data/web/views/_metrics_period_select.erb +12 -0
  83. data/web/views/_paging.erb +2 -0
  84. data/web/views/_poll_link.erb +1 -1
  85. data/web/views/busy.erb +37 -26
  86. data/web/views/dashboard.erb +36 -5
  87. data/web/views/metrics.erb +33 -20
  88. data/web/views/metrics_for_job.erb +22 -38
  89. data/web/views/morgue.erb +5 -9
  90. data/web/views/queue.erb +10 -14
  91. data/web/views/queues.erb +3 -1
  92. data/web/views/retries.erb +5 -9
  93. data/web/views/scheduled.erb +12 -13
  94. metadata +50 -40
  95. data/lib/sidekiq/delay.rb +0 -43
  96. data/lib/sidekiq/extensions/action_mailer.rb +0 -48
  97. data/lib/sidekiq/extensions/active_record.rb +0 -43
  98. data/lib/sidekiq/extensions/class_methods.rb +0 -43
  99. data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
  100. data/lib/sidekiq/metrics/deploy.rb +0 -47
  101. data/lib/sidekiq/worker.rb +0 -370
  102. data/web/assets/javascripts/graph.js +0 -16
  103. /data/{LICENSE → LICENSE.txt} +0 -0
@@ -1,5 +1,6 @@
1
1
  <script type="text/javascript" src="<%= root_path %>javascripts/chart.min.js"></script>
2
2
  <script type="text/javascript" src="<%= root_path %>javascripts/chartjs-plugin-annotation.min.js"></script>
3
+ <script type="text/javascript" src="<%= root_path %>javascripts/base-charts.js"></script>
3
4
  <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js"></script>
4
5
 
5
6
  <%
@@ -13,73 +14,56 @@
13
14
  %>
14
15
 
15
16
  <% if job_result.totals["s"] > 0 %>
16
- <div class="header-with-subheader">
17
- <h1>
18
- <a href="<%= root_path %>/metrics"><%= t(:metrics).to_s.titleize %></a> /
19
- <%= h @name %>
20
- </h1>
21
- <h2>Histogram summary</h2>
17
+ <div class="header-container">
18
+ <div class="page-title-container">
19
+ <h1>
20
+ <a href="<%= root_path %>metrics?period=<%= @period %>"><%= t('Metrics') %></a> /
21
+ <%= h @name %>
22
+ </h1>
23
+
24
+ <a target="blank" href="https://github.com/sidekiq/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
25
+ </div>
26
+
27
+ <%= erb :_metrics_period_select, locals: { periods: @periods, period: @period, path: "#{root_path}metrics/#{@name}" } %>
22
28
  </div>
23
29
 
24
30
  <canvas id="hist-totals-chart"></canvas>
25
31
 
26
32
  <script>
27
33
  window.histTotalsChart = new HistTotalsChart(
28
- "hist-totals-chart",
34
+ document.getElementById("hist-totals-chart"),
29
35
  <%= Sidekiq.dump_json({
30
36
  series: hist_totals,
31
37
  labels: bucket_labels,
38
+ xLabel: t('ExecutionTime'),
39
+ yLabel: t('Jobs'),
40
+ units: t('Jobs').downcase,
32
41
  }) %>
33
42
  )
34
43
  </script>
35
44
 
36
- <h2>Performance over time</h2>
37
-
38
45
  <canvas id="hist-bubble-chart"></canvas>
39
46
 
40
47
  <script>
41
48
  window.histBubbleChart = new HistBubbleChart(
42
- "hist-bubble-chart",
49
+ document.getElementById("hist-bubble-chart"),
43
50
  <%= Sidekiq.dump_json({
44
51
  hist: job_result.hist,
45
52
  marks: @query_result.marks.map { |m| [m.bucket, m.label] },
46
53
  labels: @query_result.buckets,
47
54
  histIntervals: bucket_intervals,
55
+ yLabel: t('ExecutionTime'),
56
+ markLabel: t('Deploy'),
57
+ yUnits: t('Seconds').downcase,
58
+ zUnits: t('Jobs').downcase,
48
59
  }) %>
49
60
  )
50
61
  </script>
51
62
 
52
- <div class="table_container">
53
- <table class="table table-bordered table-striped table-hover">
54
- <tbody>
55
- <tr>
56
- <th><%= t('Time') %></th>
57
- <th><%= t('Processed') %></th>
58
- <th><%= t('Failed') %></th>
59
- <th><%= t('ExecutionTime') %></th>
60
- <th><%= t('AvgExecutionTime') %></th>
61
- </tr>
62
- <% @query_result.buckets.reverse.each do |bucket| %>
63
- <tr>
64
- <td><%= bucket %></td>
65
- <td><%= job_result.series.dig("p", bucket) %></td>
66
- <td><%= job_result.series.dig("f", bucket) %></td>
67
- <% if (total_sec = job_result.series.dig("s", bucket)) > 0 %>
68
- <td><%= total_sec.round(2) %> seconds</td>
69
- <td><%= job_result.series_avg("s")[bucket].round(2) %> seconds</td>
70
- <% else %>
71
- <td>&mdash;</td>
72
- <td>&mdash;</td>
73
- <% end %>
74
- </tr>
75
- <% end %>
76
- </tbody>
77
- </table>
78
- </div>
79
63
  <p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p>
80
64
  <% else %>
81
65
  <h1>
82
- <a href="<%= root_path %>/metrics"><%= t(:metrics).to_s.titleize %></a> /
66
+ <a href="<%= root_path %>/metrics"><%= t('Metrics') %></a> /
83
67
  <%= h @name %>
84
68
  </h1>
85
69
 
data/web/views/morgue.erb CHANGED
@@ -1,14 +1,10 @@
1
- <header class="row">
2
- <div class="col-sm-5">
3
- <h3><%= t('DeadJobs') %></h3>
4
- </div>
1
+ <div class="header-container">
2
+ <h1><%= t('DeadJobs') %></h1>
5
3
  <% if @dead.size > 0 && @total_size > @count %>
6
- <div class="col-sm-4">
7
- <%= erb :_paging, locals: { url: "#{root_path}morgue" } %>
8
- </div>
4
+ <%= erb :_paging, locals: { url: "#{root_path}morgue" } %>
9
5
  <% end %>
10
6
  <%= filtering('dead') %>
11
- </header>
7
+ </div>
12
8
 
13
9
  <% if @dead.size > 0 %>
14
10
  <form action="<%= root_path %>morgue" method="post">
@@ -33,7 +29,7 @@
33
29
  <tr>
34
30
  <td class="table-checkbox">
35
31
  <label>
36
- <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
32
+ <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' class='shift_clickable' />
37
33
  </label>
38
34
  </td>
39
35
  <td>
data/web/views/queue.erb CHANGED
@@ -1,17 +1,13 @@
1
- <header class="row">
2
- <div class="col-sm-5">
3
- <h3>
4
- <%= t('CurrentMessagesInQueue', :queue => h(@name)) %>
5
- <% if @queue.paused? %>
6
- <span class="label label-danger"><%= t('Paused') %></span>
7
- <% end %>
8
- <span class="badge badge-secondary"><%= number_with_delimiter(@total_size) %></span>
9
- </h3>
10
- </div>
11
- <div class="col-sm-4 pull-right flip">
12
- <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
13
- </div>
14
- </header>
1
+ <div class="header-container">
2
+ <h1><%= t('CurrentMessagesInQueue', :queue => h(@name)) %>
3
+ <% if @queue.paused? %>
4
+ <span class="label label-danger"><%= t('Paused') %></span>
5
+ <% end %>
6
+ <span class="badge badge-secondary"><%= number_with_delimiter(@total_size) %></span>
7
+ </h1>
8
+ <%= erb :_paging, locals: { url: "#{root_path}queues/#{CGI.escape(@name)}" } %>
9
+ </div>
10
+
15
11
  <div class="table_container">
16
12
  <table class="queue table table-hover table-bordered table-striped">
17
13
  <thead>
data/web/views/queues.erb CHANGED
@@ -1,4 +1,6 @@
1
- <h3><%= t('Queues') %></h3>
1
+ <div class="header-container">
2
+ <h1><%= t('Queues') %></h1>
3
+ </div>
2
4
 
3
5
  <div class="table_container">
4
6
  <table class="queues table table-hover table-bordered table-striped">
@@ -1,14 +1,10 @@
1
- <header class="row">
2
- <div class="col-sm-5">
3
- <h3><%= t('Retries') %></h3>
4
- </div>
1
+ <div class="header-container">
2
+ <h1><%= t('Retries') %></h1>
5
3
  <% if @retries.size > 0 && @total_size > @count %>
6
- <div class="col-sm-4">
7
- <%= erb :_paging, locals: { url: "#{root_path}retries" } %>
8
- </div>
4
+ <%= erb :_paging, locals: { url: "#{root_path}retries" } %>
9
5
  <% end %>
10
6
  <%= filtering('retries') %>
11
- </header>
7
+ </div>
12
8
 
13
9
  <% if @retries.size > 0 %>
14
10
  <form action="<%= root_path %>retries" method="post">
@@ -34,7 +30,7 @@
34
30
  <tr>
35
31
  <td class="table-checkbox">
36
32
  <label>
37
- <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
33
+ <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' class='shift_clickable' />
38
34
  </label>
39
35
  </td>
40
36
  <td>
@@ -1,25 +1,22 @@
1
- <header class="row">
2
- <div class="col-sm-5">
3
- <h3><%= t('ScheduledJobs') %></h3>
4
- </div>
1
+ <div class="header-container">
2
+ <h1><%= t('ScheduledJobs') %></h1>
5
3
  <% if @scheduled.size > 0 && @total_size > @count %>
6
- <div class="col-sm-4">
7
- <%= erb :_paging, locals: { url: "#{root_path}scheduled" } %>
8
- </div>
4
+ <%= erb :_paging, locals: { url: "#{root_path}scheduled" } %>
9
5
  <% end %>
10
6
  <%= filtering('scheduled') %>
11
- </header>
7
+ </div>
12
8
 
13
9
  <% if @scheduled.size > 0 %>
14
-
15
10
  <form action="<%= root_path %>scheduled" method="post">
16
11
  <%= csrf_tag %>
17
12
  <div class="table_container">
18
13
  <table class="table table-striped table-bordered table-hover">
19
14
  <thead>
20
15
  <tr>
21
- <th class="checkbox-column">
22
- <input type="checkbox" class="check_all" />
16
+ <th class="table-checkbox checkbox-column">
17
+ <label>
18
+ <input type="checkbox" class="check_all" />
19
+ </label>
23
20
  </th>
24
21
  <th><%= t('When') %></th>
25
22
  <th><%= t('Queue') %></th>
@@ -29,8 +26,10 @@
29
26
  </thead>
30
27
  <% @scheduled.each do |entry| %>
31
28
  <tr>
32
- <td>
33
- <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
29
+ <td class="table-checkbox">
30
+ <label>
31
+ <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' class='shift_clickable' />
32
+ </label>
34
33
  </td>
35
34
  <td>
36
35
  <a href="<%= root_path %>scheduled/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
metadata CHANGED
@@ -1,72 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.12
4
+ version: 7.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: redis
14
+ name: redis-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
18
- - !ruby/object:Gem::Version
19
- version: '5'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 4.5.0
19
+ version: 0.11.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "<"
28
- - !ruby/object:Gem::Version
29
- version: '5'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: 4.5.0
26
+ version: 0.11.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: connection_pool
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "<"
38
- - !ruby/object:Gem::Version
39
- version: '3'
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
- version: 2.2.5
33
+ version: 2.3.0
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "<"
48
- - !ruby/object:Gem::Version
49
- version: '3'
50
38
  - - ">="
51
39
  - !ruby/object:Gem::Version
52
- version: 2.2.5
40
+ version: 2.3.0
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: rack
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
- - - "~>"
45
+ - - ">="
58
46
  - !ruby/object:Gem::Version
59
- version: '2.0'
47
+ version: 2.2.4
60
48
  type: :runtime
61
49
  prerelease: false
62
50
  version_requirements: !ruby/object:Gem::Requirement
63
51
  requirements:
64
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.2.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "<"
65
67
  - !ruby/object:Gem::Version
66
- version: '2.0'
68
+ version: '2'
67
69
  description: Simple, efficient background processing for Ruby.
68
70
  email:
69
- - mperham@gmail.com
71
+ - info@contribsys.com
70
72
  executables:
71
73
  - sidekiq
72
74
  - sidekiqmon
@@ -74,7 +76,7 @@ extensions: []
74
76
  extra_rdoc_files: []
75
77
  files:
76
78
  - Changes.md
77
- - LICENSE
79
+ - LICENSE.txt
78
80
  - README.md
79
81
  - bin/sidekiq
80
82
  - bin/sidekiqload
@@ -85,14 +87,13 @@ files:
85
87
  - lib/generators/sidekiq/templates/job_test.rb.erb
86
88
  - lib/sidekiq.rb
87
89
  - lib/sidekiq/api.rb
90
+ - lib/sidekiq/capsule.rb
88
91
  - lib/sidekiq/cli.rb
89
92
  - lib/sidekiq/client.rb
90
93
  - lib/sidekiq/component.rb
91
- - lib/sidekiq/delay.rb
92
- - lib/sidekiq/extensions/action_mailer.rb
93
- - lib/sidekiq/extensions/active_record.rb
94
- - lib/sidekiq/extensions/class_methods.rb
95
- - lib/sidekiq/extensions/generic_proxy.rb
94
+ - lib/sidekiq/config.rb
95
+ - lib/sidekiq/deploy.rb
96
+ - lib/sidekiq/embedded.rb
96
97
  - lib/sidekiq/fetch.rb
97
98
  - lib/sidekiq/job.rb
98
99
  - lib/sidekiq/job_logger.rb
@@ -101,7 +102,6 @@ files:
101
102
  - lib/sidekiq/launcher.rb
102
103
  - lib/sidekiq/logger.rb
103
104
  - lib/sidekiq/manager.rb
104
- - lib/sidekiq/metrics/deploy.rb
105
105
  - lib/sidekiq/metrics/query.rb
106
106
  - lib/sidekiq/metrics/shared.rb
107
107
  - lib/sidekiq/metrics/tracking.rb
@@ -129,17 +129,18 @@ files:
129
129
  - lib/sidekiq/web/csrf_protection.rb
130
130
  - lib/sidekiq/web/helpers.rb
131
131
  - lib/sidekiq/web/router.rb
132
- - lib/sidekiq/worker.rb
132
+ - lib/sidekiq/worker_compatibility_alias.rb
133
133
  - sidekiq.gemspec
134
134
  - web/assets/images/apple-touch-icon.png
135
135
  - web/assets/images/favicon.ico
136
136
  - web/assets/images/logo.png
137
137
  - web/assets/images/status.png
138
138
  - web/assets/javascripts/application.js
139
+ - web/assets/javascripts/base-charts.js
139
140
  - web/assets/javascripts/chart.min.js
140
141
  - web/assets/javascripts/chartjs-plugin-annotation.min.js
142
+ - web/assets/javascripts/dashboard-charts.js
141
143
  - web/assets/javascripts/dashboard.js
142
- - web/assets/javascripts/graph.js
143
144
  - web/assets/javascripts/metrics.js
144
145
  - web/assets/stylesheets/application-dark.css
145
146
  - web/assets/stylesheets/application-rtl.css
@@ -176,6 +177,7 @@ files:
176
177
  - web/locales/zh-tw.yml
177
178
  - web/views/_footer.erb
178
179
  - web/views/_job_info.erb
180
+ - web/views/_metrics_period_select.erb
179
181
  - web/views/_nav.erb
180
182
  - web/views/_paging.erb
181
183
  - web/views/_poll_link.erb
@@ -199,11 +201,18 @@ licenses:
199
201
  - LGPL-3.0
200
202
  metadata:
201
203
  homepage_uri: https://sidekiq.org
202
- bug_tracker_uri: https://github.com/mperham/sidekiq/issues
203
- documentation_uri: https://github.com/mperham/sidekiq/wiki
204
- changelog_uri: https://github.com/mperham/sidekiq/blob/main/Changes.md
205
- source_code_uri: https://github.com/mperham/sidekiq
206
- post_install_message:
204
+ bug_tracker_uri: https://github.com/sidekiq/sidekiq/issues
205
+ documentation_uri: https://github.com/sidekiq/sidekiq/wiki
206
+ changelog_uri: https://github.com/sidekiq/sidekiq/blob/main/Changes.md
207
+ source_code_uri: https://github.com/sidekiq/sidekiq
208
+ post_install_message: |2+
209
+
210
+ Welcome to Sidekiq 7.0!
211
+
212
+ 1. Use `gem 'sidekiq', '<7'` in your Gemfile if you don't want this new version.
213
+ 2. Read the release notes at https://github.com/sidekiq/sidekiq/blob/main/docs/7.0-Upgrade.md
214
+ 3. If you have problems, search for open/closed issues at https://github.com/sidekiq/sidekiq/issues/
215
+
207
216
  rdoc_options: []
208
217
  require_paths:
209
218
  - lib
@@ -211,15 +220,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
220
  requirements:
212
221
  - - ">="
213
222
  - !ruby/object:Gem::Version
214
- version: 2.5.0
223
+ version: 2.7.0
215
224
  required_rubygems_version: !ruby/object:Gem::Requirement
216
225
  requirements:
217
226
  - - ">="
218
227
  - !ruby/object:Gem::Version
219
228
  version: '0'
220
229
  requirements: []
221
- rubygems_version: 3.4.20
230
+ rubygems_version: 3.4.7
222
231
  signing_key:
223
232
  specification_version: 4
224
233
  summary: Simple, efficient background processing for Ruby
225
234
  test_files: []
235
+ ...
data/lib/sidekiq/delay.rb DELETED
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sidekiq # :nodoc:
4
- module Extensions
5
- def self.enable_delay!
6
- warn "Sidekiq's Delayed Extensions will be removed in Sidekiq 7.0", uplevel: 1
7
-
8
- if defined?(::ActiveSupport)
9
- require "sidekiq/extensions/active_record"
10
- require "sidekiq/extensions/action_mailer"
11
-
12
- # Need to patch Psych so it can autoload classes whose names are serialized
13
- # in the delayed YAML.
14
- Psych::Visitors::ToRuby.prepend(Sidekiq::Extensions::PsychAutoload)
15
-
16
- ActiveSupport.on_load(:active_record) do
17
- include Sidekiq::Extensions::ActiveRecord
18
- end
19
- ActiveSupport.on_load(:action_mailer) do
20
- extend Sidekiq::Extensions::ActionMailer
21
- end
22
- end
23
-
24
- require "sidekiq/extensions/class_methods"
25
- Module.__send__(:include, Sidekiq::Extensions::Klass)
26
- end
27
-
28
- module PsychAutoload
29
- def resolve_class(klass_name)
30
- return nil if !klass_name || klass_name.empty?
31
- # constantize
32
- names = klass_name.split("::")
33
- names.shift if names.empty? || names.first.empty?
34
-
35
- names.inject(Object) do |constant, name|
36
- constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
37
- end
38
- rescue NameError
39
- super
40
- end
41
- end
42
- end
43
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "sidekiq/extensions/generic_proxy"
4
-
5
- module Sidekiq
6
- module Extensions
7
- ##
8
- # Adds +delay+, +delay_for+ and +delay_until+ methods to ActionMailer to offload arbitrary email
9
- # delivery to Sidekiq.
10
- #
11
- # @example
12
- # UserMailer.delay.send_welcome_email(new_user)
13
- # UserMailer.delay_for(5.days).send_welcome_email(new_user)
14
- # UserMailer.delay_until(5.days.from_now).send_welcome_email(new_user)
15
- class DelayedMailer
16
- include Sidekiq::Worker
17
-
18
- def perform(yml)
19
- (target, method_name, args) = YAML.load(yml)
20
- msg = target.public_send(method_name, *args)
21
- # The email method can return nil, which causes ActionMailer to return
22
- # an undeliverable empty message.
23
- if msg
24
- msg.deliver_now
25
- else
26
- raise "#{target.name}##{method_name} returned an undeliverable mail object"
27
- end
28
- end
29
- end
30
-
31
- module ActionMailer
32
- def sidekiq_delay(options = {})
33
- Proxy.new(DelayedMailer, self, options)
34
- end
35
-
36
- def sidekiq_delay_for(interval, options = {})
37
- Proxy.new(DelayedMailer, self, options.merge("at" => Time.now.to_f + interval.to_f))
38
- end
39
-
40
- def sidekiq_delay_until(timestamp, options = {})
41
- Proxy.new(DelayedMailer, self, options.merge("at" => timestamp.to_f))
42
- end
43
- alias_method :delay, :sidekiq_delay
44
- alias_method :delay_for, :sidekiq_delay_for
45
- alias_method :delay_until, :sidekiq_delay_until
46
- end
47
- end
48
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "sidekiq/extensions/generic_proxy"
4
-
5
- module Sidekiq
6
- module Extensions
7
- ##
8
- # Adds +delay+, +delay_for+ and +delay_until+ methods to ActiveRecord to offload instance method
9
- # execution to Sidekiq.
10
- #
11
- # @example
12
- # User.recent_signups.each { |user| user.delay.mark_as_awesome }
13
- #
14
- # Please note, this is not recommended as this will serialize the entire
15
- # object to Redis. Your Sidekiq jobs should pass IDs, not entire instances.
16
- # This is here for backwards compatibility with Delayed::Job only.
17
- class DelayedModel
18
- include Sidekiq::Worker
19
-
20
- def perform(yml)
21
- (target, method_name, args) = YAML.load(yml)
22
- target.__send__(method_name, *args)
23
- end
24
- end
25
-
26
- module ActiveRecord
27
- def sidekiq_delay(options = {})
28
- Proxy.new(DelayedModel, self, options)
29
- end
30
-
31
- def sidekiq_delay_for(interval, options = {})
32
- Proxy.new(DelayedModel, self, options.merge("at" => Time.now.to_f + interval.to_f))
33
- end
34
-
35
- def sidekiq_delay_until(timestamp, options = {})
36
- Proxy.new(DelayedModel, self, options.merge("at" => timestamp.to_f))
37
- end
38
- alias_method :delay, :sidekiq_delay
39
- alias_method :delay_for, :sidekiq_delay_for
40
- alias_method :delay_until, :sidekiq_delay_until
41
- end
42
- end
43
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "sidekiq/extensions/generic_proxy"
4
-
5
- module Sidekiq
6
- module Extensions
7
- ##
8
- # Adds `delay`, `delay_for` and `delay_until` methods to all Classes to offload class method
9
- # execution to Sidekiq.
10
- #
11
- # @example
12
- # User.delay.delete_inactive
13
- # Wikipedia.delay.download_changes_for(Date.today)
14
- #
15
- class DelayedClass
16
- include Sidekiq::Worker
17
-
18
- def perform(yml)
19
- (target, method_name, args) = YAML.load(yml)
20
- target.__send__(method_name, *args)
21
- end
22
- end
23
-
24
- module Klass
25
- def sidekiq_delay(options = {})
26
- Proxy.new(DelayedClass, self, options)
27
- end
28
-
29
- def sidekiq_delay_for(interval, options = {})
30
- Proxy.new(DelayedClass, self, options.merge("at" => Time.now.to_f + interval.to_f))
31
- end
32
-
33
- def sidekiq_delay_until(timestamp, options = {})
34
- Proxy.new(DelayedClass, self, options.merge("at" => timestamp.to_f))
35
- end
36
- alias_method :delay, :sidekiq_delay
37
- alias_method :delay_for, :sidekiq_delay_for
38
- alias_method :delay_until, :sidekiq_delay_until
39
- end
40
- end
41
- end
42
-
43
- Module.__send__(:include, Sidekiq::Extensions::Klass) unless defined?(::Rails)
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaml"
4
-
5
- module Sidekiq
6
- module Extensions
7
- SIZE_LIMIT = 8_192
8
-
9
- class Proxy < BasicObject
10
- def initialize(performable, target, options = {})
11
- @performable = performable
12
- @target = target
13
- @opts = options.transform_keys(&:to_s)
14
- end
15
-
16
- def method_missing(name, *args)
17
- # Sidekiq has a limitation in that its message must be JSON.
18
- # JSON can't round trip real Ruby objects so we use YAML to
19
- # serialize the objects to a String. The YAML will be converted
20
- # to JSON and then deserialized on the other side back into a
21
- # Ruby object.
22
- obj = [@target, name, args]
23
- marshalled = ::YAML.dump(obj)
24
- if marshalled.size > SIZE_LIMIT
25
- ::Sidekiq.logger.warn { "#{@target}.#{name} job argument is #{marshalled.bytesize} bytes, you should refactor it to reduce the size" }
26
- end
27
- @performable.client_push({"class" => @performable,
28
- "args" => [marshalled],
29
- "display_class" => "#{@target}.#{name}"}.merge(@opts))
30
- end
31
- end
32
- end
33
- end