sidekiq-failures 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.2.1
4
+ * Fix exhausted mode when retry is disabled (@wr0ngway)
5
+
3
6
  ## 0.2.0
4
7
  * Added processor identity to failure data (@krasnoukhov)
5
8
  * Handle Sidekiq::Shutdown exceptions (@krasnoukhov)
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-failures (0.2.0)
4
+ sidekiq-failures (0.2.1)
5
5
  sidekiq (>= 2.2.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- celluloid (0.14.0)
10
+ celluloid (0.14.1)
11
11
  timers (>= 1.0.0)
12
- connection_pool (1.0.0)
12
+ connection_pool (1.1.0)
13
13
  hike (1.2.1)
14
14
  json (1.8.0)
15
15
  multi_json (1.7.3)
@@ -22,8 +22,8 @@ GEM
22
22
  redis (3.0.4)
23
23
  redis-namespace (1.3.0)
24
24
  redis (~> 3.0.0)
25
- sidekiq (2.12.0)
26
- celluloid (>= 0.14.0)
25
+ sidekiq (2.12.4)
26
+ celluloid (>= 0.14.1)
27
27
  connection_pool (>= 1.0.0)
28
28
  json
29
29
  redis (>= 3.0)
@@ -58,7 +58,7 @@ module Sidekiq
58
58
  end
59
59
 
60
60
  def last_try?
61
- retry_count == max_retries - 1
61
+ ! msg['retry'] || retry_count == max_retries - 1
62
62
  end
63
63
 
64
64
  def retry_count
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Failures
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -93,7 +93,7 @@ module Sidekiq
93
93
  it "doesn't record failure if going to be retired again and configured to track exhaustion by default" do
94
94
  Sidekiq.failures_default_mode = :exhausted
95
95
 
96
- msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'] )
96
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => true )
97
97
 
98
98
  assert_equal 0, failures_count
99
99
 
@@ -107,7 +107,7 @@ module Sidekiq
107
107
 
108
108
 
109
109
  it "doesn't record failure if going to be retired again and configured to track exhaustion" do
110
- msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'failures' => 'exhausted')
110
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => true, 'failures' => 'exhausted')
111
111
 
112
112
  assert_equal 0, failures_count
113
113
 
@@ -120,7 +120,35 @@ module Sidekiq
120
120
  end
121
121
 
122
122
  it "records failure if failing last retry and configured to track exhaustion" do
123
- msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry_count' => 24, 'failures' => 'exhausted')
123
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => true, 'retry_count' => 24, 'failures' => 'exhausted')
124
+
125
+ assert_equal 0, failures_count
126
+
127
+ assert_raises TestException do
128
+ @processor.process(msg)
129
+ end
130
+
131
+ assert_equal 1, failures_count
132
+ assert_equal 1, $invokes
133
+ end
134
+
135
+ it "records failure if retry disabled and configured to track exhaustion" do
136
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => false, 'failures' => 'exhausted')
137
+
138
+ assert_equal 0, failures_count
139
+
140
+ assert_raises TestException do
141
+ @processor.process(msg)
142
+ end
143
+
144
+ assert_equal 1, failures_count
145
+ assert_equal 1, $invokes
146
+ end
147
+
148
+ it "records failure if retry disabled and configured to track exhaustion by default" do
149
+ Sidekiq.failures_default_mode = 'exhausted'
150
+
151
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => false)
124
152
 
125
153
  assert_equal 0, failures_count
126
154
 
@@ -135,7 +163,7 @@ module Sidekiq
135
163
  it "records failure if failing last retry and configured to track exhaustion by default" do
136
164
  Sidekiq.failures_default_mode = 'exhausted'
137
165
 
138
- msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry_count' => 24)
166
+ msg = create_work('class' => MockWorker.to_s, 'args' => ['myarg'], 'retry' => true, 'retry_count' => 24)
139
167
 
140
168
  assert_equal 0, failures_count
141
169
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-failures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-12 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  segments:
147
147
  - 0
148
- hash: -4370758603814256180
148
+ hash: -2579273263044937702
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  segments:
156
156
  - 0
157
- hash: -4370758603814256180
157
+ hash: -2579273263044937702
158
158
  requirements: []
159
159
  rubyforge_project:
160
160
  rubygems_version: 1.8.23