sidekiq 6.0.1 → 6.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.

@@ -11,8 +11,6 @@ module Sidekiq
11
11
  module Util
12
12
  include ExceptionHandler
13
13
 
14
- EXPIRY = 60 * 60 * 24
15
-
16
14
  def watchdog(last_words)
17
15
  yield
18
16
  rescue Exception => ex
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sidekiq
4
- VERSION = "6.0.1"
4
+ VERSION = "6.0.6"
5
5
  end
@@ -31,7 +31,7 @@ module Sidekiq
31
31
  "Queues" => "queues",
32
32
  "Retries" => "retries",
33
33
  "Scheduled" => "scheduled",
34
- "Dead" => "morgue",
34
+ "Dead" => "morgue"
35
35
  }
36
36
 
37
37
  class << self
@@ -5,7 +5,6 @@ module Sidekiq
5
5
  extend WebRouter
6
6
 
7
7
  CONTENT_LENGTH = "Content-Length"
8
- CONTENT_TYPE = "Content-Type"
9
8
  REDIS_KEYS = %w[redis_version uptime_in_days connected_clients used_memory_human used_memory_peak_human]
10
9
  CSP_HEADER = [
11
10
  "default-src 'self' https: http:",
@@ -20,7 +19,7 @@ module Sidekiq
20
19
  "script-src 'self' https: http: 'unsafe-inline'",
21
20
  "style-src 'self' https: http: 'unsafe-inline'",
22
21
  "worker-src 'self'",
23
- "base-uri 'self'",
22
+ "base-uri 'self'"
24
23
  ].join("; ").freeze
25
24
 
26
25
  def initialize(klass)
@@ -91,7 +90,15 @@ module Sidekiq
91
90
  end
92
91
 
93
92
  post "/queues/:name" do
94
- Sidekiq::Queue.new(route_params[:name]).clear
93
+ queue = Sidekiq::Queue.new(route_params[:name])
94
+
95
+ if Sidekiq.pro? && params["pause"]
96
+ queue.pause!
97
+ elsif Sidekiq.pro? && params["unpause"]
98
+ queue.unpause!
99
+ else
100
+ queue.clear
101
+ end
95
102
 
96
103
  redirect "#{root_path}queues"
97
104
  end
@@ -268,7 +275,7 @@ module Sidekiq
268
275
  scheduled: sidekiq_stats.scheduled_size,
269
276
  retries: sidekiq_stats.retry_size,
270
277
  dead: sidekiq_stats.dead_size,
271
- default_latency: sidekiq_stats.default_queue_latency,
278
+ default_latency: sidekiq_stats.default_queue_latency
272
279
  },
273
280
  redis: redis_stats,
274
281
  server_utc_time: server_utc_time
@@ -293,22 +300,20 @@ module Sidekiq
293
300
 
294
301
  resp = case resp
295
302
  when Array
303
+ # redirects go here
296
304
  resp
297
305
  else
306
+ # rendered content goes here
298
307
  headers = {
299
308
  "Content-Type" => "text/html",
300
309
  "Cache-Control" => "no-cache",
301
310
  "Content-Language" => action.locale,
302
- "Content-Security-Policy" => CSP_HEADER,
311
+ "Content-Security-Policy" => CSP_HEADER
303
312
  }
304
-
313
+ # we'll let Rack calculate Content-Length for us.
305
314
  [200, headers, [resp]]
306
315
  end
307
316
 
308
- resp[1] = resp[1].dup
309
-
310
- resp[1][CONTENT_LENGTH] = resp[2].inject(0) { |l, p| l + p.bytesize }.to_s
311
-
312
317
  resp
313
318
  end
314
319
 
@@ -156,12 +156,6 @@ module Sidekiq
156
156
  @stats ||= Sidekiq::Stats.new
157
157
  end
158
158
 
159
- def retries_with_score(score)
160
- Sidekiq.redis { |conn|
161
- conn.zrangebyscore("retry", score, score)
162
- }.map { |msg| Sidekiq.load_json(msg) }
163
- end
164
-
165
159
  def redis_connection
166
160
  Sidekiq.redis do |conn|
167
161
  c = conn.connection
@@ -301,7 +295,7 @@ module Sidekiq
301
295
  end
302
296
 
303
297
  def environment_title_prefix
304
- environment = Sidekiq.options[:environment] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
298
+ environment = Sidekiq.options[:environment] || ENV["APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
305
299
 
306
300
  "[#{environment.upcase}] " unless environment == "production"
307
301
  end
@@ -94,9 +94,7 @@ module Sidekiq
94
94
  {} if path == matcher
95
95
  else
96
96
  path_match = path.match(matcher)
97
- if path_match
98
- Hash[path_match.names.map(&:to_sym).zip(path_match.captures)]
99
- end
97
+ path_match&.named_captures&.transform_keys(&:to_sym)
100
98
  end
101
99
  end
102
100
  end
@@ -48,8 +48,8 @@ module Sidekiq
48
48
  # In practice, any option is allowed. This is the main mechanism to configure the
49
49
  # options for a specific job.
50
50
  def sidekiq_options(opts = {})
51
- opts = Hash[opts.map { |k, v| [k.to_s, v] }] # stringify
52
- self.sidekiq_options_hash = get_sidekiq_options.merge(Hash[opts.map { |k, v| [k.to_s, v] }])
51
+ opts = opts.transform_keys(&:to_s) # stringify
52
+ self.sidekiq_options_hash = get_sidekiq_options.merge(opts)
53
53
  end
54
54
 
55
55
  def sidekiq_retry_in(&block)
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.add_dependency "redis", ">= 4.1.0"
18
18
  gem.add_dependency "connection_pool", ">= 2.2.2"
19
- gem.add_dependency "rack", ">= 2.0.0"
19
+ gem.add_dependency "rack", "~> 2.0"
20
20
  gem.add_dependency "rack-protection", ">= 2.0.0"
21
21
  end
@@ -19,7 +19,8 @@ Sidekiq = {};
19
19
  $(function() {
20
20
  var pollpath = $('body').data('poll-path');
21
21
  if (pollpath != "") {
22
- updatePage(pollpath);
22
+ var ti = parseInt(localStorage.timeInterval) || 2000;
23
+ setTimeout(function(){updatePage(pollpath)}, ti);
23
24
  }
24
25
 
25
26
  $(document).on('click', '.check_all', function() {
@@ -55,26 +56,28 @@ function updateFuzzyTimes(locale) {
55
56
  }
56
57
 
57
58
  function updatePage(url) {
58
- setInterval(function () {
59
- $.ajax({
60
- url: url,
61
- dataType: 'html'
62
- }).done(function (data) {
63
- $data = $(data)
64
-
65
- var $page = $data.filter('#page')
66
- $('#page').replaceWith($page)
67
-
68
- var $header_status = $data.find('.status')
69
- $('.status').replaceWith($header_status)
70
-
71
- updateFuzzyTimes($('body').data('locale'));
72
- })
73
- }, parseInt(localStorage.timeInterval) || 2000);
59
+ $.ajax({
60
+ url: url,
61
+ dataType: 'html'
62
+ }).done(function(data) {
63
+ $data = $(data)
64
+
65
+ var $page = $data.filter('#page')
66
+ $('#page').replaceWith($page)
67
+
68
+ var $header_status = $data.find('.status')
69
+ $('.status').replaceWith($header_status)
70
+
71
+ updateFuzzyTimes($('body').data('locale'));
72
+
73
+ var ti = parseInt(localStorage.timeInterval) || 2000;
74
+ setTimeout(function(){updatePage(url)}, ti)
75
+ }).fail(function() {
76
+ var ti = parseInt(localStorage.timeInterval) || 2000;
77
+ setTimeout(function(){updatePage(url)}, ti)
78
+ })
74
79
  }
75
80
 
76
-
77
-
78
81
  $(function() {
79
82
  'use strict';
80
83
 
@@ -1,125 +1,122 @@
1
- @media (prefers-color-scheme: dark) {
2
-
3
- body {
4
- background-color: #000;
5
- color: #ccc;
6
- }
7
-
8
- a,
9
- .title,
10
- .summary_bar ul .count,
11
- .navbar .navbar-brand {
12
- color: #af0014;
13
- }
14
-
15
- .navbar .navbar-brand:hover {
16
- color: #ccc;
17
- }
18
-
19
- .navbar .navbar-brand .status {
20
- color: #ccc;
21
- }
22
-
23
- .navbar-inverse {
24
- background-color: #000;
25
- border-color: #333;
26
- }
27
-
28
- table.table-white {
29
- background-color: #111;
30
- }
31
-
32
- .table-striped > tbody > tr:nth-of-type(odd) {
33
- background-color: #222;
34
- }
35
-
36
- .table-bordered,
37
- .table-bordered > tbody > tr > td,
38
- .table-bordered > tbody > tr > th,
39
- .table-bordered > tfoot > tr > td,
40
- .table-bordered > tfoot > tr > th,
41
- .table-bordered > thead > tr > td,
42
- .table-bordered > thead > tr > th {
43
- border: 1px solid #333;
44
- }
45
-
46
- .table-hover > tbody > tr:hover {
47
- background-color: #333;
48
- }
49
-
50
- .alert {
51
- border: none;
52
- color: #ccc;
53
- }
54
-
55
- .alert-success {
56
- background-color: #000;
57
- }
58
-
59
- a:link,
60
- a:active,
61
- a:hover,
62
- a:visited {
63
- color: #63798c;
64
- }
65
-
66
- a.btn {
67
- color: #000;
68
- }
69
-
70
- .summary_bar .summary {
71
- background-color: #000;
72
- border: 1px solid #333;
73
- }
74
-
75
- .navbar-default {
76
- background-color: #000;
77
- border-color: #3d3d3d;
78
- }
79
-
80
- .navbar-default .navbar-nav > .active > a,
81
- .navbar-default .navbar-nav > .active > a:focus,
82
- .navbar-default .navbar-nav > .active > a:hover {
83
- color: #ccc;
84
- background-color: #282828;
85
- }
86
-
87
- .navbar-default .navbar-nav > li > a:hover {
88
- color: #ccc;
89
- }
90
-
91
- .pagination > li > a,
92
- .pagination > li > a:hover,
93
- .pagination > li > span {
94
- color: #ccc;
95
- background-color: #282828;
96
- border-color: #353535;
97
- }
98
- .pagination > .disabled > a,
99
- .pagination > .disabled > a:focus,
100
- .pagination > .disabled > a:hover,
101
- .pagination > .disabled > span,
102
- .pagination > .disabled > span:focus,
103
- .pagination > .disabled > span:hover {
104
- color: #a5a5a5;
105
- background-color: #282828;
106
- border-color: #353535;
107
- }
108
-
109
- .stat {
110
- border: 1px solid rgba(255, 255, 255, 0.1);
111
- }
112
-
113
- #live-poll {
114
- color: #ccc;
115
- }
116
-
117
- .btn-warn {
118
- color: #333;
119
- }
120
-
121
- .rickshaw_graph .y_ticks.glow text {
122
- fill: #ccc;
123
- color: #ccc;
124
- }
1
+ body {
2
+ background-color: #000;
3
+ color: #ccc;
4
+ }
5
+
6
+ a,
7
+ .title,
8
+ .summary_bar ul .count,
9
+ .navbar .navbar-brand {
10
+ color: #af0014;
11
+ }
12
+
13
+ .navbar .navbar-brand:hover {
14
+ color: #ccc;
15
+ }
16
+
17
+ .navbar .navbar-brand .status {
18
+ color: #ccc;
19
+ }
20
+
21
+ .navbar-inverse {
22
+ background-color: #000;
23
+ border-color: #333;
24
+ }
25
+
26
+ table.table-white {
27
+ background-color: #111;
28
+ }
29
+
30
+ .table-striped > tbody > tr:nth-of-type(odd) {
31
+ background-color: #222;
32
+ }
33
+
34
+ .table-bordered,
35
+ .table-bordered > tbody > tr > td,
36
+ .table-bordered > tbody > tr > th,
37
+ .table-bordered > tfoot > tr > td,
38
+ .table-bordered > tfoot > tr > th,
39
+ .table-bordered > thead > tr > td,
40
+ .table-bordered > thead > tr > th {
41
+ border: 1px solid #333;
42
+ }
43
+
44
+ .table-hover > tbody > tr:hover {
45
+ background-color: #333;
46
+ }
47
+
48
+ .alert {
49
+ border: none;
50
+ color: #ccc;
51
+ }
52
+
53
+ .alert-success {
54
+ background-color: #000;
55
+ }
56
+
57
+ a:link,
58
+ a:active,
59
+ a:hover,
60
+ a:visited {
61
+ color: #63798c;
62
+ }
63
+
64
+ a.btn {
65
+ color: #000;
66
+ }
67
+
68
+ .summary_bar .summary {
69
+ background-color: #000;
70
+ border: 1px solid #333;
71
+ }
72
+
73
+ .navbar-default {
74
+ background-color: #000;
75
+ border-color: #3d3d3d;
76
+ }
77
+
78
+ .navbar-default .navbar-nav > .active > a,
79
+ .navbar-default .navbar-nav > .active > a:focus,
80
+ .navbar-default .navbar-nav > .active > a:hover {
81
+ color: #ccc;
82
+ background-color: #282828;
83
+ }
84
+
85
+ .navbar-default .navbar-nav > li > a:hover {
86
+ color: #ccc;
87
+ }
88
+
89
+ .pagination > li > a,
90
+ .pagination > li > a:hover,
91
+ .pagination > li > span {
92
+ color: #ccc;
93
+ background-color: #282828;
94
+ border-color: #353535;
95
+ }
96
+ .pagination > .disabled > a,
97
+ .pagination > .disabled > a:focus,
98
+ .pagination > .disabled > a:hover,
99
+ .pagination > .disabled > span,
100
+ .pagination > .disabled > span:focus,
101
+ .pagination > .disabled > span:hover {
102
+ color: #a5a5a5;
103
+ background-color: #282828;
104
+ border-color: #353535;
105
+ }
106
+
107
+ .stat {
108
+ border: 1px solid rgba(255, 255, 255, 0.1);
109
+ }
110
+
111
+ #live-poll {
112
+ color: #ccc;
113
+ }
114
+
115
+ .btn-warn {
116
+ color: #333;
117
+ }
118
+
119
+ .rickshaw_graph .y_ticks.glow text {
120
+ fill: #ccc;
121
+ color: #ccc;
125
122
  }