sidekiq 2.0.1 → 2.0.2

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.

data/Changes.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.0.2
2
+ -----------
3
+
4
+ - Fix "Retry Now" button on individual retry page. (ezkl)
5
+
1
6
  2.0.1
2
7
  -----------
3
8
 
@@ -8,6 +8,10 @@ require 'sidekiq/middleware/server/logging'
8
8
  require 'sidekiq/middleware/server/timeout'
9
9
 
10
10
  module Sidekiq
11
+ ##
12
+ # The Processor receives a message from the Manager and actually
13
+ # processes it. It instantiates the worker, runs the middleware
14
+ # chain and then calls Sidekiq::Worker#perform.
11
15
  class Processor
12
16
  include Util
13
17
  include Celluloid
@@ -29,6 +33,11 @@ module Sidekiq
29
33
  def process(msg, queue)
30
34
  klass = constantize(msg['class'])
31
35
  worker = klass.new
36
+
37
+ # Celluloid actor calls are performed within a Fiber.
38
+ # This would give us a terribly small 4KB stack on MRI
39
+ # so we use Celluloid's defer to run things in a thread pool
40
+ # in order to get a full-sized stack for the Worker.
32
41
  defer do
33
42
  stats(worker, msg, queue) do
34
43
  Sidekiq.server_middleware.invoke(worker, msg, queue) do
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -128,6 +128,11 @@ module Sidekiq
128
128
  slim :index
129
129
  end
130
130
 
131
+ get "/queues" do
132
+ @queues = queues
133
+ slim :queues
134
+ end
135
+
131
136
  get "/queues/:name" do
132
137
  halt 404 unless params[:name]
133
138
  count = (params[:count] || 10).to_i
@@ -146,7 +151,7 @@ module Sidekiq
146
151
  conn.del("queue:#{params[:name]}")
147
152
  conn.srem("queues", params[:name])
148
153
  end
149
- redirect root_path
154
+ redirect "#{root_path}queues"
150
155
  end
151
156
 
152
157
  get "/retries/:score" do
@@ -194,9 +199,9 @@ module Sidekiq
194
199
  halt 404 unless params[:score]
195
200
  score = params[:score].to_f
196
201
  if params['retry']
197
- process_score(score, :retry)
202
+ process_score('retry', score, :retry)
198
203
  elsif params['delete']
199
- process_score(score, :delete)
204
+ process_score('retry', score, :delete)
200
205
  end
201
206
  redirect root_path
202
207
  end
@@ -1,6 +1,6 @@
1
1
  class HardWorker
2
2
  include Sidekiq::Worker
3
- sidekiq_options :timeout => 60, :backtrace => 5, :timeout => 20
3
+ sidekiq_options :timeout => 20, :backtrace => 5
4
4
 
5
5
  def perform(name, count, salt)
6
6
  raise name if name == 'crash'
@@ -24,33 +24,20 @@ class TestWeb < MiniTest::Unit::TestCase
24
24
  end
25
25
  end
26
26
 
27
- it 'shows active queues' do
27
+ it 'can display home' do
28
28
  get '/'
29
29
  assert_equal 200, last_response.status
30
30
  assert_match /Sidekiq is idle/, last_response.body
31
31
  refute_match /default/, last_response.body
32
+ end
32
33
 
33
- assert WebWorker.perform_async(1, 2)
34
-
35
- get '/'
36
- assert_equal 200, last_response.status
37
- assert_match /Sidekiq is idle/, last_response.body
38
- assert_match /default/, last_response.body
39
- refute_match /foo/, last_response.body
40
-
34
+ it 'can display queues' do
41
35
  assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3])
42
36
 
43
- get '/'
37
+ get '/queues'
44
38
  assert_equal 200, last_response.status
45
- assert_match /Sidekiq is idle/, last_response.body
46
- assert_match /default/, last_response.body
47
39
  assert_match /foo/, last_response.body
48
- assert_match /Backlog: 2/, last_response.body
49
- end
50
-
51
- it 'handles queues with no name' do
52
- get '/queues'
53
- assert_equal 404, last_response.status
40
+ refute_match /HardWorker/, last_response.body
54
41
  end
55
42
 
56
43
  it 'handles missing retry' do
@@ -117,6 +104,30 @@ class TestWeb < MiniTest::Unit::TestCase
117
104
  assert_equal 200, last_response.status
118
105
  assert_match /HardWorker/, last_response.body
119
106
  end
107
+
108
+ it 'can delete a single retry' do
109
+ _, score = add_retry
110
+
111
+ post "/retries/#{score}", 'delete' => 'Delete'
112
+ assert_equal 302, last_response.status
113
+ assert_equal 'http://example.org/', last_response.header['Location']
114
+
115
+ get "/retries"
116
+ assert_equal 200, last_response.status
117
+ refute_match /#{score}/, last_response.body
118
+ end
119
+
120
+ it 'can retry a single retry now' do
121
+ msg, score = add_retry
122
+
123
+ post "/retries/#{score}", 'retry' => 'Retry'
124
+ assert_equal 302, last_response.status
125
+ assert_equal 'http://example.org/', last_response.header['Location']
126
+
127
+ get '/queues/default'
128
+ assert_equal 200, last_response.status
129
+ assert_match /#{msg['args'][2]}/, last_response.body
130
+ end
120
131
 
121
132
  def add_scheduled
122
133
  msg = { 'class' => 'HardWorker',
@@ -1,4 +1,3 @@
1
-
2
1
  .hero-unit
3
2
  h1 Sidekiq is #{current_status}
4
3
  p Processed: #{processed}
@@ -8,44 +7,19 @@
8
7
  p Retries Pending: #{zcard('retry')}
9
8
  p Queue Backlog: #{backlog}
10
9
 
11
- .tabbable
12
- ul.nav.nav-tabs
13
- li.active
14
- a href="#workers" data-toggle="tab" Busy Workers
15
- li
16
- a href="#queues" data-toggle="tab" Queues
17
- .tab-content
18
- #workers.tab-pane.active
19
- table class="table table-striped table-bordered"
20
- tr
21
- th Worker
22
- th Queue
23
- th Class
24
- th Arguments
25
- th Started
26
- - workers.each do |(worker, msg)|
27
- tr
28
- td= worker
29
- td= msg['queue']
30
- td= msg['payload']['class']
31
- td= msg['payload']['args'].inspect[0..100]
32
- td== relative_time(Time.parse(msg['run_at']))
33
- form action="#{root_path}reset" method="post"
34
- button.btn type="submit" title="If you kill -9 Sidekiq, this table can fill up with old data." Clear worker list
35
-
36
- #queues.tab-pane
37
- table class="table table-striped table-bordered"
38
- tr
39
- th Queue
40
- th Size
41
- th
42
- - queues.each do |(queue, size)|
43
- tr
44
- td
45
- a href="#{root_path}queues/#{queue}" #{queue}
46
- td= size
47
- td
48
- form action="#{root_path}queues/#{queue}" method="post"
49
- input.btn.btn-danger type="submit" name="delete" value="Delete"
50
-
51
-
10
+ table class="table table-striped table-bordered"
11
+ tr
12
+ th Worker
13
+ th Queue
14
+ th Class
15
+ th Arguments
16
+ th Started
17
+ - workers.each do |(worker, msg)|
18
+ tr
19
+ td= worker
20
+ td= msg['queue']
21
+ td= msg['payload']['class']
22
+ td= msg['payload']['args'].inspect[0..100]
23
+ td== relative_time(Time.parse(msg['run_at']))
24
+ form action="#{root_path}reset" method="post"
25
+ button.btn type="submit" title="If you kill -9 Sidekiq, this table can fill up with old data." Clear worker list
@@ -12,6 +12,8 @@ html
12
12
  ul.nav
13
13
  li
14
14
  a href='#{{root_path}}' Home
15
+ li
16
+ a href='#{{root_path}}queues' Queues
15
17
  li
16
18
  a href='#{{root_path}}retries' Retries
17
19
  li
@@ -0,0 +1,19 @@
1
+ h1 Queues
2
+
3
+ - if @queues.size > 0
4
+ table class="table table-striped table-bordered"
5
+ tr
6
+ th Queue
7
+ th Size
8
+ th
9
+ - queues.each do |(queue, size)|
10
+ tr
11
+ td
12
+ a href="#{root_path}queues/#{queue}" #{queue}
13
+ td= size
14
+ td
15
+ form action="#{root_path}queues/#{queue}" method="post"
16
+ input.btn.btn-danger type="submit" name="delete" value="Delete"
17
+ - else
18
+ p No queues found.
19
+ a href="#{root_path}" Back
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: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
12
+ date: 2012-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70196173811640 !ruby/object:Gem::Requirement
16
+ requirement: &70093698877540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70196173811640
24
+ version_requirements: *70093698877540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70196173810860 !ruby/object:Gem::Requirement
27
+ requirement: &70093698876900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70196173810860
35
+ version_requirements: *70093698876900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: connection_pool
38
- requirement: &70196173808820 !ruby/object:Gem::Requirement
38
+ requirement: &70093698876280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70196173808820
46
+ version_requirements: *70093698876280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: celluloid
49
- requirement: &70196173808020 !ruby/object:Gem::Requirement
49
+ requirement: &70093698875780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.11.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70196173808020
57
+ version_requirements: *70093698875780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: multi_json
60
- requirement: &70196173807440 !ruby/object:Gem::Requirement
60
+ requirement: &70093698891660 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70196173807440
68
+ version_requirements: *70093698891660
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
- requirement: &70196173806860 !ruby/object:Gem::Requirement
71
+ requirement: &70093698891180 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '3'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70196173806860
79
+ version_requirements: *70093698891180
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sinatra
82
- requirement: &70196173806360 !ruby/object:Gem::Requirement
82
+ requirement: &70093698890800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70196173806360
90
+ version_requirements: *70093698890800
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: slim
93
- requirement: &70196173805420 !ruby/object:Gem::Requirement
93
+ requirement: &70093698890340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70196173805420
101
+ version_requirements: *70093698890340
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &70196173804720 !ruby/object:Gem::Requirement
104
+ requirement: &70093698889860 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70196173804720
112
+ version_requirements: *70093698889860
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: actionmailer
115
- requirement: &70196173803700 !ruby/object:Gem::Requirement
115
+ requirement: &70093698889320 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '3'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70196173803700
123
+ version_requirements: *70093698889320
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: activerecord
126
- requirement: &70196173802600 !ruby/object:Gem::Requirement
126
+ requirement: &70093698888640 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: '3'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70196173802600
134
+ version_requirements: *70093698888640
135
135
  description: Simple, efficient message processing for Ruby
136
136
  email:
137
137
  - mperham@gmail.com
@@ -274,6 +274,7 @@ files:
274
274
  - web/views/index.slim
275
275
  - web/views/layout.slim
276
276
  - web/views/queue.slim
277
+ - web/views/queues.slim
277
278
  - web/views/retries.slim
278
279
  - web/views/retry.slim
279
280
  - web/views/scheduled.slim