sidekiq 6.3.1 → 7.0.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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +140 -4
  3. data/LICENSE.txt +9 -0
  4. data/README.md +19 -13
  5. data/bin/sidekiq +4 -9
  6. data/bin/sidekiqload +71 -76
  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 +267 -186
  13. data/lib/sidekiq/capsule.rb +110 -0
  14. data/lib/sidekiq/cli.rb +82 -78
  15. data/lib/sidekiq/client.rb +73 -80
  16. data/lib/sidekiq/{util.rb → component.rb} +13 -42
  17. data/lib/sidekiq/config.rb +271 -0
  18. data/lib/sidekiq/deploy.rb +62 -0
  19. data/lib/sidekiq/embedded.rb +61 -0
  20. data/lib/sidekiq/fetch.rb +22 -21
  21. data/lib/sidekiq/job.rb +375 -10
  22. data/lib/sidekiq/job_logger.rb +16 -28
  23. data/lib/sidekiq/job_retry.rb +79 -56
  24. data/lib/sidekiq/job_util.rb +71 -0
  25. data/lib/sidekiq/launcher.rb +76 -82
  26. data/lib/sidekiq/logger.rb +9 -44
  27. data/lib/sidekiq/manager.rb +40 -41
  28. data/lib/sidekiq/metrics/query.rb +153 -0
  29. data/lib/sidekiq/metrics/shared.rb +95 -0
  30. data/lib/sidekiq/metrics/tracking.rb +134 -0
  31. data/lib/sidekiq/middleware/chain.rb +84 -42
  32. data/lib/sidekiq/middleware/current_attributes.rb +19 -13
  33. data/lib/sidekiq/middleware/i18n.rb +6 -4
  34. data/lib/sidekiq/middleware/modules.rb +21 -0
  35. data/lib/sidekiq/monitor.rb +1 -1
  36. data/lib/sidekiq/paginator.rb +16 -8
  37. data/lib/sidekiq/processor.rb +56 -59
  38. data/lib/sidekiq/rails.rb +10 -9
  39. data/lib/sidekiq/redis_client_adapter.rb +118 -0
  40. data/lib/sidekiq/redis_connection.rb +13 -82
  41. data/lib/sidekiq/ring_buffer.rb +29 -0
  42. data/lib/sidekiq/scheduled.rb +75 -37
  43. data/lib/sidekiq/testing/inline.rb +4 -4
  44. data/lib/sidekiq/testing.rb +41 -68
  45. data/lib/sidekiq/transaction_aware_client.rb +44 -0
  46. data/lib/sidekiq/version.rb +2 -1
  47. data/lib/sidekiq/web/action.rb +3 -3
  48. data/lib/sidekiq/web/application.rb +27 -8
  49. data/lib/sidekiq/web/csrf_protection.rb +3 -3
  50. data/lib/sidekiq/web/helpers.rb +22 -20
  51. data/lib/sidekiq/web.rb +6 -17
  52. data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
  53. data/lib/sidekiq.rb +85 -202
  54. data/sidekiq.gemspec +29 -5
  55. data/web/assets/javascripts/application.js +58 -26
  56. data/web/assets/javascripts/base-charts.js +106 -0
  57. data/web/assets/javascripts/chart.min.js +13 -0
  58. data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
  59. data/web/assets/javascripts/dashboard-charts.js +166 -0
  60. data/web/assets/javascripts/dashboard.js +3 -240
  61. data/web/assets/javascripts/metrics.js +236 -0
  62. data/web/assets/stylesheets/application-dark.css +13 -17
  63. data/web/assets/stylesheets/application-rtl.css +2 -91
  64. data/web/assets/stylesheets/application.css +67 -300
  65. data/web/locales/ar.yml +70 -70
  66. data/web/locales/cs.yml +62 -62
  67. data/web/locales/da.yml +52 -52
  68. data/web/locales/de.yml +65 -65
  69. data/web/locales/el.yml +43 -24
  70. data/web/locales/en.yml +82 -69
  71. data/web/locales/es.yml +68 -68
  72. data/web/locales/fa.yml +65 -65
  73. data/web/locales/fr.yml +67 -67
  74. data/web/locales/he.yml +65 -64
  75. data/web/locales/hi.yml +59 -59
  76. data/web/locales/it.yml +53 -53
  77. data/web/locales/ja.yml +71 -68
  78. data/web/locales/ko.yml +52 -52
  79. data/web/locales/lt.yml +66 -66
  80. data/web/locales/nb.yml +61 -61
  81. data/web/locales/nl.yml +52 -52
  82. data/web/locales/pl.yml +45 -45
  83. data/web/locales/pt-br.yml +63 -55
  84. data/web/locales/pt.yml +51 -51
  85. data/web/locales/ru.yml +67 -66
  86. data/web/locales/sv.yml +53 -53
  87. data/web/locales/ta.yml +60 -60
  88. data/web/locales/uk.yml +62 -61
  89. data/web/locales/ur.yml +64 -64
  90. data/web/locales/vi.yml +67 -67
  91. data/web/locales/zh-cn.yml +37 -11
  92. data/web/locales/zh-tw.yml +42 -8
  93. data/web/views/_footer.erb +5 -2
  94. data/web/views/_nav.erb +1 -1
  95. data/web/views/_summary.erb +1 -1
  96. data/web/views/busy.erb +9 -4
  97. data/web/views/dashboard.erb +36 -4
  98. data/web/views/metrics.erb +80 -0
  99. data/web/views/metrics_for_job.erb +69 -0
  100. data/web/views/queue.erb +5 -1
  101. metadata +75 -27
  102. data/LICENSE +0 -9
  103. data/lib/generators/sidekiq/worker_generator.rb +0 -57
  104. data/lib/sidekiq/delay.rb +0 -41
  105. data/lib/sidekiq/exception_handler.rb +0 -27
  106. data/lib/sidekiq/extensions/action_mailer.rb +0 -48
  107. data/lib/sidekiq/extensions/active_record.rb +0 -43
  108. data/lib/sidekiq/extensions/class_methods.rb +0 -43
  109. data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
  110. data/lib/sidekiq/worker.rb +0 -311
@@ -0,0 +1,80 @@
1
+ <script type="text/javascript" src="<%= root_path %>javascripts/chart.min.js"></script>
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>
4
+ <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js"></script>
5
+
6
+ <div class="header-container">
7
+ <h1><%= t('Metrics') %></h1>
8
+
9
+ <div>
10
+ <a target="blank" href="https://github.com/mperham/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
11
+ </div>
12
+ </div>
13
+
14
+ <%
15
+ table_limit = 20
16
+ chart_limit = 5
17
+ job_results = @query_result.job_results.sort_by { |(kls, jr)| jr.totals["s"] }.reverse.first(table_limit)
18
+ visible_kls = job_results.first(chart_limit).map(&:first)
19
+ %>
20
+
21
+ <% if job_results.any? %>
22
+ <canvas id="job-metrics-overview-chart"></canvas>
23
+
24
+ <script>
25
+ window.jobMetricsChart = new JobMetricsOverviewChart(
26
+ document.getElementById("job-metrics-overview-chart"),
27
+ <%= Sidekiq.dump_json({
28
+ series: job_results.map { |(kls, jr)| [kls, jr.dig("series", "s")] }.to_h,
29
+ marks: @query_result.marks.map { |m| [m.bucket, m.label] },
30
+ labels: @query_result.buckets,
31
+ visibleKls: visible_kls,
32
+ yLabel: t('TotalExecutionTime'),
33
+ units: t('Seconds').downcase,
34
+ markLabel: t('Deploy'),
35
+ }) %>
36
+ )
37
+ </script>
38
+ <% end %>
39
+
40
+ <div class="table_container">
41
+ <table class="table table-bordered table-striped table-hover">
42
+ <tbody>
43
+ <tr>
44
+ <th><%= t('Name') %></th>
45
+ <th><%= t('Success') %></th>
46
+ <th><%= t('Failure') %></th>
47
+ <th><%= t('TotalExecutionTime') %></th>
48
+ <th><%= t('AvgExecutionTime') %></th>
49
+ </tr>
50
+ <% if job_results.any? %>
51
+ <% job_results.each_with_index do |(kls, jr), i| %>
52
+ <tr>
53
+ <td>
54
+ <div class="metrics-swatch-wrapper">
55
+ <% id = "metrics-swatch-#{kls}" %>
56
+ <input
57
+ type="checkbox"
58
+ id="<%= id %>"
59
+ class="metrics-swatch"
60
+ value="<%= kls %>"
61
+ <%= visible_kls.include?(kls) ? 'checked' : '' %>
62
+ />
63
+ <code><a href="<%= root_path %>metrics/<%= kls %>"><%= kls %></a></code>
64
+ </div>
65
+ <script>jobMetricsChart.registerSwatch("<%= id %>")</script>
66
+ </td>
67
+ <td><%= jr.dig("totals", "p") - jr.dig("totals", "f") %></td>
68
+ <td><%= jr.dig("totals", "f") %></td>
69
+ <td><%= jr.dig("totals", "s").round(2) %> seconds</td>
70
+ <td><%= jr.total_avg("s").round(2) %> seconds</td>
71
+ </tr>
72
+ <% end %>
73
+ <% else %>
74
+ <tr><td colspan=5><%= t("NoDataFound") %></td></tr>
75
+ <% end %>
76
+ </tbody>
77
+ </table>
78
+ </div>
79
+
80
+ <p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p>
@@ -0,0 +1,69 @@
1
+ <script type="text/javascript" src="<%= root_path %>javascripts/chart.min.js"></script>
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>
4
+ <script type="text/javascript" src="<%= root_path %>javascripts/metrics.js"></script>
5
+
6
+ <%
7
+ job_result = @query_result.job_results[@name]
8
+ hist_totals = job_result.hist.values.first.zip(*job_result.hist.values[1..-1]).map(&:sum)
9
+ bucket_labels =Sidekiq::Metrics::Histogram::LABELS
10
+ bucket_intervals =Sidekiq::Metrics::Histogram::BUCKET_INTERVALS.reverse
11
+
12
+ # Replace INFINITY since it can't be represented as JSON
13
+ bucket_intervals[0] = bucket_intervals[1] * 2
14
+ %>
15
+
16
+ <% if job_result.totals["s"] > 0 %>
17
+ <div class="header-container">
18
+ <h1>
19
+ <a href="<%= root_path %>metrics"><%= t(:metrics).to_s.titleize %></a> /
20
+ <%= h @name %>
21
+ </h1>
22
+
23
+ <div>
24
+ <a target="blank" href="https://github.com/mperham/sidekiq/wiki/Metrics"><span class="info-circle" title="Click to learn more about metrics">?</span></a>
25
+ </div>
26
+ </div>
27
+
28
+ <canvas id="hist-totals-chart"></canvas>
29
+
30
+ <script>
31
+ window.histTotalsChart = new HistTotalsChart(
32
+ document.getElementById("hist-totals-chart"),
33
+ <%= Sidekiq.dump_json({
34
+ series: hist_totals,
35
+ labels: bucket_labels,
36
+ xLabel: t('ExecutionTime'),
37
+ yLabel: t('Jobs'),
38
+ units: t('Jobs').downcase,
39
+ }) %>
40
+ )
41
+ </script>
42
+
43
+ <canvas id="hist-bubble-chart"></canvas>
44
+
45
+ <script>
46
+ window.histBubbleChart = new HistBubbleChart(
47
+ document.getElementById("hist-bubble-chart"),
48
+ <%= Sidekiq.dump_json({
49
+ hist: job_result.hist,
50
+ marks: @query_result.marks.map { |m| [m.bucket, m.label] },
51
+ labels: @query_result.buckets,
52
+ histIntervals: bucket_intervals,
53
+ yLabel: t('ExecutionTime'),
54
+ markLabel: t('Deploy'),
55
+ yUnits: t('Seconds').downcase,
56
+ zUnits: t('Jobs').downcase,
57
+ }) %>
58
+ )
59
+ </script>
60
+
61
+ <p><small>Data from <%= @query_result.starts_at %> to <%= @query_result.ends_at %></small></p>
62
+ <% else %>
63
+ <h1>
64
+ <a href="<%= root_path %>/metrics"><%= t(:metrics).to_s.titleize %></a> /
65
+ <%= h @name %>
66
+ </h1>
67
+
68
+ <div class="alert alert-success"><%= t('NoJobMetricsFound') %></div>
69
+ <% end %>
data/web/views/queue.erb CHANGED
@@ -18,6 +18,7 @@
18
18
  <th><a href="<%= url %>?direction=<%= params[:direction] == 'asc' ? 'desc' : 'asc' %>"># <%= sort_direction_label %></a></th>
19
19
  <th><%= t('Job') %></th>
20
20
  <th><%= t('Arguments') %></th>
21
+ <th><%= t('Context') %></th>
21
22
  <th></th>
22
23
  </thead>
23
24
  <% @jobs.each_with_index do |job, index| %>
@@ -35,12 +36,15 @@
35
36
  <% a = job.display_args %>
36
37
  <% if a.inspect.size > 100 %>
37
38
  <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
+ <button data-toggle="job_<%= index %>_full" class="btn btn-default btn-xs"><%= t('ShowAll') %></button>
39
40
  <div class="toggle" id="job_<%= index %>_full"><%= display_args(a) %></div>
40
41
  <% else %>
41
42
  <%= display_args(job.display_args) %>
42
43
  <% end %>
43
44
  </td>
45
+ <td>
46
+ <%= h(job["cattr"].inspect) if job["cattr"]&.any? %>
47
+ </td>
44
48
  <td>
45
49
  <form action="<%= root_path %>queues/<%= CGI.escape(@name) %>/delete" method="post">
46
50
  <%= csrf_tag %>
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.1
4
+ version: 7.0.0
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-11-07 00:00:00.000000000 Z
11
+ date: 2022-10-27 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
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: 0.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: 0.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: connection_pool
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.2
33
+ version: 2.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.2
40
+ version: 2.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.2.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
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
+ - - "<"
46
60
  - !ruby/object:Gem::Version
47
- version: '2.0'
61
+ version: '2'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - "<"
53
67
  - !ruby/object:Gem::Version
54
- version: '2.0'
68
+ version: '2'
55
69
  description: Simple, efficient background processing for Ruby.
56
70
  email:
57
71
  - mperham@gmail.com
@@ -62,46 +76,52 @@ extensions: []
62
76
  extra_rdoc_files: []
63
77
  files:
64
78
  - Changes.md
65
- - LICENSE
79
+ - LICENSE.txt
66
80
  - README.md
67
81
  - bin/sidekiq
68
82
  - bin/sidekiqload
69
83
  - 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
84
+ - lib/generators/sidekiq/job_generator.rb
85
+ - lib/generators/sidekiq/templates/job.rb.erb
86
+ - lib/generators/sidekiq/templates/job_spec.rb.erb
87
+ - lib/generators/sidekiq/templates/job_test.rb.erb
74
88
  - lib/sidekiq.rb
75
89
  - lib/sidekiq/api.rb
90
+ - lib/sidekiq/capsule.rb
76
91
  - lib/sidekiq/cli.rb
77
92
  - lib/sidekiq/client.rb
78
- - lib/sidekiq/delay.rb
79
- - lib/sidekiq/exception_handler.rb
80
- - lib/sidekiq/extensions/action_mailer.rb
81
- - lib/sidekiq/extensions/active_record.rb
82
- - lib/sidekiq/extensions/class_methods.rb
83
- - lib/sidekiq/extensions/generic_proxy.rb
93
+ - lib/sidekiq/component.rb
94
+ - lib/sidekiq/config.rb
95
+ - lib/sidekiq/deploy.rb
96
+ - lib/sidekiq/embedded.rb
84
97
  - lib/sidekiq/fetch.rb
85
98
  - lib/sidekiq/job.rb
86
99
  - lib/sidekiq/job_logger.rb
87
100
  - lib/sidekiq/job_retry.rb
101
+ - lib/sidekiq/job_util.rb
88
102
  - lib/sidekiq/launcher.rb
89
103
  - lib/sidekiq/logger.rb
90
104
  - lib/sidekiq/manager.rb
105
+ - lib/sidekiq/metrics/query.rb
106
+ - lib/sidekiq/metrics/shared.rb
107
+ - lib/sidekiq/metrics/tracking.rb
91
108
  - lib/sidekiq/middleware/chain.rb
92
109
  - lib/sidekiq/middleware/current_attributes.rb
93
110
  - lib/sidekiq/middleware/i18n.rb
111
+ - lib/sidekiq/middleware/modules.rb
94
112
  - lib/sidekiq/monitor.rb
95
113
  - lib/sidekiq/paginator.rb
96
114
  - lib/sidekiq/processor.rb
97
115
  - lib/sidekiq/rails.rb
116
+ - lib/sidekiq/redis_client_adapter.rb
98
117
  - lib/sidekiq/redis_connection.rb
118
+ - lib/sidekiq/ring_buffer.rb
99
119
  - lib/sidekiq/scheduled.rb
100
120
  - lib/sidekiq/sd_notify.rb
101
121
  - lib/sidekiq/systemd.rb
102
122
  - lib/sidekiq/testing.rb
103
123
  - lib/sidekiq/testing/inline.rb
104
- - lib/sidekiq/util.rb
124
+ - lib/sidekiq/transaction_aware_client.rb
105
125
  - lib/sidekiq/version.rb
106
126
  - lib/sidekiq/web.rb
107
127
  - lib/sidekiq/web/action.rb
@@ -109,14 +129,19 @@ files:
109
129
  - lib/sidekiq/web/csrf_protection.rb
110
130
  - lib/sidekiq/web/helpers.rb
111
131
  - lib/sidekiq/web/router.rb
112
- - lib/sidekiq/worker.rb
132
+ - lib/sidekiq/worker_compatibility_alias.rb
113
133
  - sidekiq.gemspec
114
134
  - web/assets/images/apple-touch-icon.png
115
135
  - web/assets/images/favicon.ico
116
136
  - web/assets/images/logo.png
117
137
  - web/assets/images/status.png
118
138
  - web/assets/javascripts/application.js
139
+ - web/assets/javascripts/base-charts.js
140
+ - web/assets/javascripts/chart.min.js
141
+ - web/assets/javascripts/chartjs-plugin-annotation.min.js
142
+ - web/assets/javascripts/dashboard-charts.js
119
143
  - web/assets/javascripts/dashboard.js
144
+ - web/assets/javascripts/metrics.js
120
145
  - web/assets/stylesheets/application-dark.css
121
146
  - web/assets/stylesheets/application-rtl.css
122
147
  - web/assets/stylesheets/application.css
@@ -161,6 +186,8 @@ files:
161
186
  - web/views/dashboard.erb
162
187
  - web/views/dead.erb
163
188
  - web/views/layout.erb
189
+ - web/views/metrics.erb
190
+ - web/views/metrics_for_job.erb
164
191
  - web/views/morgue.erb
165
192
  - web/views/queue.erb
166
193
  - web/views/queues.erb
@@ -177,7 +204,28 @@ metadata:
177
204
  documentation_uri: https://github.com/mperham/sidekiq/wiki
178
205
  changelog_uri: https://github.com/mperham/sidekiq/blob/main/Changes.md
179
206
  source_code_uri: https://github.com/mperham/sidekiq
180
- post_install_message:
207
+ post_install_message: |2
208
+
209
+ ####################################################
210
+
211
+
212
+ █████████ █████ ██████████ ██████████ █████ ████ █████ ██████ ██████████ █████
213
+ ███░░░░░███░░███ ░░███░░░░███ ░░███░░░░░█░░███ ███░ ░░███ ███░░░░███ ░███░░░░███ ███░░░███
214
+ ░███ ░░░ ░███ ░███ ░░███ ░███ █ ░ ░███ ███ ░███ ███ ░░███ ░░░ ███ ███ ░░███
215
+ ░░█████████ ░███ ░███ ░███ ░██████ ░███████ ░███ ░███ ░███ ███ ░███ ░███
216
+ ░░░░░░░░███ ░███ ░███ ░███ ░███░░█ ░███░░███ ░███ ░███ ██░███ ███ ░███ ░███
217
+ ███ ░███ ░███ ░███ ███ ░███ ░ █ ░███ ░░███ ░███ ░░███ ░░████ ███ ░░███ ███
218
+ ░░█████████ █████ ██████████ ██████████ █████ ░░████ █████ ░░░██████░██ ███ ██ ░░░█████░
219
+ ░░░░░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░ ░░░░░ ░░░░░░ ░░ ░░░ ░░ ░░░░░░
220
+
221
+
222
+ WARNING: This is a beta release, expect breakage!
223
+
224
+ 1. Use `gem 'sidekiq', '<7'` in your Gemfile if you don't want to be a beta tester.
225
+ 2. Read the release notes at https://github.com/mperham/sidekiq/blob/main/docs/7.0-Upgrade.md
226
+ 3. Search for open/closed issues at https://github.com/mperham/sidekiq/issues/
227
+
228
+ ####################################################
181
229
  rdoc_options: []
182
230
  require_paths:
183
231
  - lib
@@ -185,14 +233,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
233
  requirements:
186
234
  - - ">="
187
235
  - !ruby/object:Gem::Version
188
- version: 2.5.0
236
+ version: 2.7.0
189
237
  required_rubygems_version: !ruby/object:Gem::Requirement
190
238
  requirements:
191
239
  - - ">="
192
240
  - !ruby/object:Gem::Version
193
241
  version: '0'
194
242
  requirements: []
195
- rubygems_version: 3.1.4
243
+ rubygems_version: 3.2.32
196
244
  signing_key:
197
245
  specification_version: 4
198
246
  summary: Simple, efficient background processing for Ruby
data/LICENSE DELETED
@@ -1,9 +0,0 @@
1
- Copyright (c) Contributed Systems LLC
2
-
3
- Sidekiq is an Open Source project licensed under the terms of
4
- the LGPLv3 license. Please see <http://www.gnu.org/licenses/lgpl-3.0.html>
5
- for license text.
6
-
7
- Sidekiq Pro has a commercial-friendly license allowing private forks
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.txt.
@@ -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
data/lib/sidekiq/delay.rb DELETED
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sidekiq
4
- module Extensions
5
- def self.enable_delay!
6
- if defined?(::ActiveSupport)
7
- require "sidekiq/extensions/active_record"
8
- require "sidekiq/extensions/action_mailer"
9
-
10
- # Need to patch Psych so it can autoload classes whose names are serialized
11
- # in the delayed YAML.
12
- Psych::Visitors::ToRuby.prepend(Sidekiq::Extensions::PsychAutoload)
13
-
14
- ActiveSupport.on_load(:active_record) do
15
- include Sidekiq::Extensions::ActiveRecord
16
- end
17
- ActiveSupport.on_load(:action_mailer) do
18
- extend Sidekiq::Extensions::ActionMailer
19
- end
20
- end
21
-
22
- require "sidekiq/extensions/class_methods"
23
- Module.__send__(:include, Sidekiq::Extensions::Klass)
24
- end
25
-
26
- module PsychAutoload
27
- def resolve_class(klass_name)
28
- return nil if !klass_name || klass_name.empty?
29
- # constantize
30
- names = klass_name.split("::")
31
- names.shift if names.empty? || names.first.empty?
32
-
33
- names.inject(Object) do |constant, name|
34
- constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
35
- end
36
- rescue NameError
37
- super
38
- end
39
- end
40
- end
41
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "sidekiq"
4
-
5
- module Sidekiq
6
- module ExceptionHandler
7
- class Logger
8
- def call(ex, ctx)
9
- Sidekiq.logger.warn(Sidekiq.dump_json(ctx)) unless ctx.empty?
10
- Sidekiq.logger.warn("#{ex.class.name}: #{ex.message}")
11
- Sidekiq.logger.warn(ex.backtrace.join("\n")) unless ex.backtrace.nil?
12
- end
13
-
14
- Sidekiq.error_handlers << Sidekiq::ExceptionHandler::Logger.new
15
- end
16
-
17
- def handle_exception(ex, ctx = {})
18
- Sidekiq.error_handlers.each do |handler|
19
- handler.call(ex, ctx)
20
- rescue => ex
21
- Sidekiq.logger.error "!!! ERROR HANDLER THREW AN ERROR !!!"
22
- Sidekiq.logger.error ex
23
- Sidekiq.logger.error ex.backtrace.join("\n") unless ex.backtrace.nil?
24
- end
25
- end
26
- end
27
- 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)