sidekiq 2.0.0 → 2.0.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.

data/Changes.md CHANGED
@@ -1,3 +1,17 @@
1
+ 2.0.1
2
+ -----------
3
+
4
+ - Add "Clear Workers" button to UI. If you kill -9 Sidekiq, the workers
5
+ set can fill up with stale entries.
6
+ - Update sidekiq/testing to support new scheduled jobs API:
7
+
8
+ ```ruby
9
+ require 'sidekiq/testing'
10
+ DirectWorker.perform_in(10.seconds, 1, 2)
11
+ assert_equal 1, DirectWorker.jobs.size
12
+ assert_in_delta 10.seconds.from_now.to_f, DirectWorker.jobs.last['at'], 0.01
13
+ ```
14
+
1
15
  2.0.0
2
16
  -----------
3
17
 
@@ -30,6 +30,16 @@ module Sidekiq
30
30
  true
31
31
  end
32
32
 
33
+ alias_method :perform_in_old, :perform_in
34
+ alias_method :perform_at_old, :perform_at
35
+ def perform_in(interval, *args)
36
+ int = interval.to_f
37
+ ts = (int < 1_000_000_000 ? Time.now.to_f + int : int)
38
+ jobs << { 'class' => self.name, 'args' => args, 'at' => ts }
39
+ true
40
+ end
41
+ alias_method :perform_at, :perform_in
42
+
33
43
  def jobs
34
44
  @pushed ||= []
35
45
  end
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
@@ -36,6 +36,15 @@ module Sidekiq
36
36
 
37
37
  helpers do
38
38
 
39
+ def reset_worker_list
40
+ Sidekiq.redis do |conn|
41
+ workers = conn.smembers('workers')
42
+ workers.each do |name|
43
+ conn.srem('workers', name)
44
+ end
45
+ end
46
+ end
47
+
39
48
  def workers
40
49
  @workers ||= begin
41
50
  Sidekiq.redis do |conn|
@@ -127,6 +136,11 @@ module Sidekiq
127
136
  slim :queue
128
137
  end
129
138
 
139
+ post "/reset" do
140
+ reset_worker_list
141
+ redirect root_path
142
+ end
143
+
130
144
  post "/queues/:name" do
131
145
  Sidekiq.redis do |conn|
132
146
  conn.del("queue:#{params[:name]}")
@@ -53,9 +53,11 @@ class TestTesting < MiniTest::Unit::TestCase
53
53
  after do
54
54
  # Undo override
55
55
  Sidekiq::Worker::ClassMethods.class_eval do
56
- remove_method :perform_async
57
- alias_method :perform_async, :perform_async_old
58
- remove_method :perform_async_old
56
+ %w(async at in).each do |token|
57
+ remove_method :"perform_#{token}"
58
+ alias_method :"perform_#{token}", :"perform_#{token}_old"
59
+ remove_method :"perform_#{token}_old"
60
+ end
59
61
  end
60
62
  end
61
63
 
@@ -63,6 +65,11 @@ class TestTesting < MiniTest::Unit::TestCase
63
65
  assert_equal 0, DirectWorker.jobs.size
64
66
  assert DirectWorker.perform_async(1, 2)
65
67
  assert_equal 1, DirectWorker.jobs.size
68
+ assert DirectWorker.perform_in(10, 1, 2)
69
+ assert_equal 2, DirectWorker.jobs.size
70
+ assert DirectWorker.perform_at(10, 1, 2)
71
+ assert_equal 3, DirectWorker.jobs.size
72
+ assert_in_delta 10.seconds.from_now.to_f, DirectWorker.jobs.last['at'], 0.01
66
73
  end
67
74
 
68
75
  it 'stubs the delay call on mailers' do
@@ -30,6 +30,8 @@
30
30
  td= msg['payload']['class']
31
31
  td= msg['payload']['args'].inspect[0..100]
32
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
33
35
 
34
36
  #queues.tab-pane
35
37
  table class="table table-striped table-bordered"
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.0
4
+ version: 2.0.1
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-01 00:00:00.000000000 Z
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70308439006360 !ruby/object:Gem::Requirement
16
+ requirement: &70196173811640 !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: *70308439006360
24
+ version_requirements: *70196173811640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70308439005860 !ruby/object:Gem::Requirement
27
+ requirement: &70196173810860 !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: *70308439005860
35
+ version_requirements: *70196173810860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: connection_pool
38
- requirement: &70308439005040 !ruby/object:Gem::Requirement
38
+ requirement: &70196173808820 !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: *70308439005040
46
+ version_requirements: *70196173808820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: celluloid
49
- requirement: &70308438999880 !ruby/object:Gem::Requirement
49
+ requirement: &70196173808020 !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: *70308438999880
57
+ version_requirements: *70196173808020
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: multi_json
60
- requirement: &70308438998500 !ruby/object:Gem::Requirement
60
+ requirement: &70196173807440 !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: *70308438998500
68
+ version_requirements: *70196173807440
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
- requirement: &70308438997400 !ruby/object:Gem::Requirement
71
+ requirement: &70196173806860 !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: *70308438997400
79
+ version_requirements: *70196173806860
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sinatra
82
- requirement: &70308438996900 !ruby/object:Gem::Requirement
82
+ requirement: &70196173806360 !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: *70308438996900
90
+ version_requirements: *70196173806360
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: slim
93
- requirement: &70308438996320 !ruby/object:Gem::Requirement
93
+ requirement: &70196173805420 !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: *70308438996320
101
+ version_requirements: *70196173805420
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &70308438995720 !ruby/object:Gem::Requirement
104
+ requirement: &70196173804720 !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: *70308438995720
112
+ version_requirements: *70196173804720
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: actionmailer
115
- requirement: &70308438994740 !ruby/object:Gem::Requirement
115
+ requirement: &70196173803700 !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: *70308438994740
123
+ version_requirements: *70196173803700
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: activerecord
126
- requirement: &70308438992940 !ruby/object:Gem::Requirement
126
+ requirement: &70196173802600 !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: *70308438992940
134
+ version_requirements: *70196173802600
135
135
  description: Simple, efficient message processing for Ruby
136
136
  email:
137
137
  - mperham@gmail.com