resque-lock-timeout 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6fc8ebf154ea6508ebd762f6860002c07f70412d
4
- data.tar.gz: 7053ff9081baa02832267aeb5739ec9d46317269
3
+ metadata.gz: 15a27985b2511a44c3f9808f0083d08f8f023d5d
4
+ data.tar.gz: 7daba033435c96b21d64119c9722019c95873e63
5
5
  SHA512:
6
- metadata.gz: 590c45f94ec0dc1b40612a94b7545b7c01964eeced9e7ce0d5b0e4f0af4763cdca0223fc991e6c66c03cb462a497a31fb1cb28aa611673153e2cbcd83ed343a0
7
- data.tar.gz: c678088940a1857169695fa0907dad6b9cf9839c3f9f571c974128dfcebef92dba36e960a5143452ce515d7542e74eb99004e5590be9f14cc8207e3e23e8e091
6
+ metadata.gz: 5ad5415a6ee68d5a9a8692d0cad712247fad35cb24604ee9b2b108778b168ac7a78d7ca5e7f0bd7e5d77b9c599a01eb158f9975571d7ed7e916579a49d9ff343
7
+ data.tar.gz: 41cb07ffda36778df97b21e5a52a37d1d3941aa185fe9fadb0bb5b723004137bf6accfbc030faa8403f2b61b1c7b409ed2797f1ab17afd2c7bcdbe0b43a21dcb
data/HISTORY.md CHANGED
@@ -1,39 +1,43 @@
1
+ ## 0.4.5 (2015-08-04)
2
+
3
+ - Fix: ensure exceptions are kept if raised **after** lock timeout expires.
4
+
1
5
  ## 0.4.4 (2014-02-21)
2
6
 
3
- * Add `enqueued?` and `loner_locked?` helper methods.
4
- * Bump minimum version of resque to v1.22
7
+ - Add: `enqueued?` and `loner_locked?` helper methods.
8
+ - Bump minimum version of resque to v1.22
5
9
 
6
10
  ## 0.4.1 (2012-11-19)
7
11
 
8
- * Bug fix, allow `@loner` job to be enqueued if timeout expires.
12
+ - Fix: allow `@loner` job to be enqueued if timeout expires.
9
13
 
10
14
  ## 0.4.0 (2012-11-09)
11
15
 
12
- * Add `@loner` boolean option to prevent job being enqueued if already
16
+ - Add: `@loner` boolean option to prevent job being enqueued if already
13
17
  running/enqueued. (Thanks to @ssaunier)
14
18
 
15
19
  ## 0.3.3 (2012-03-09)
16
20
 
17
- * Tested against v1.20.0 of resque.
21
+ - Tested against v1.20.0 of resque.
18
22
 
19
23
  ## 0.3.1 (2011-07-16)
20
24
 
21
- * Pass job arguments to `lock_timeout`. (Bob Potter)
22
- * Added `refresh_lock!` method for long running jobs. (Bob Potter)
25
+ - Pass job arguments to `lock_timeout`. (Bob Potter)
26
+ - Added `refresh_lock!` method for long running jobs. (Bob Potter)
23
27
 
24
28
  ## 0.3.0 (2011-07-16)
25
29
 
26
- * Ability to customize redis connection used for storing locks.
30
+ - Ability to customize redis connection used for storing locks.
27
31
  (thanks Richie Vos =))
28
- * Added Bundler `Gemfile`.
29
- * Added abstract stub methods for callback methods:
32
+ - Added Bundler `Gemfile`.
33
+ - Added abstract stub methods for callback methods:
30
34
  `lock_failed`, `lock_expired_before_release`
31
35
 
32
36
  ## 0.2.1 (2010-06-16)
33
37
 
34
- * Relax gemspec dependancies.
38
+ - Relax gemspec dependancies.
35
39
 
36
40
  ## 0.2.0 (2010-05-05)
37
41
 
38
- * Initial release as `resque-lock-timeout`, forked from Chris Wanstrath'
39
- `resque-lock`.
42
+ - Initial release as `resque-lock-timeout`, forked from Chris Wanstrath'
43
+ `resque-lock`.
@@ -287,15 +287,13 @@ module Resque
287
287
  ensure
288
288
  # Release the lock on success and error. Unless a lock_timeout is
289
289
  # used, then we need to be more careful before releasing the lock.
290
- unless lock_until === true
291
- now = Time.now.to_i
292
- if lock_until < now
293
- # Eeek! Lock expired before perform finished. Trigger callback.
294
- lock_expired_before_release(*args)
295
- return # dont relase lock.
296
- end
290
+ now = Time.now.to_i
291
+ if lock_until != true and lock_until < now
292
+ # Eeek! Lock expired before perform finished. Trigger callback.
293
+ lock_expired_before_release(*args)
294
+ else
295
+ release_lock!(*args)
297
296
  end
298
- release_lock!(*args)
299
297
  end
300
298
  end
301
299
 
@@ -225,4 +225,10 @@ class LockTest < Minitest::Test
225
225
  Resque.enqueue(LonelyJob)
226
226
  assert_equal 1, Resque.size(:test), "Should have enqueued the job"
227
227
  end
228
+
229
+ def test_exceptions_in_job_after_timeout_should_be_marked_as_failure
230
+ Resque.enqueue(FailingAfterTimeoutJob)
231
+ @worker.process
232
+ assert_equal 1, Resque::Failure.count, "Should have been marked as failure"
233
+ end
228
234
  end
@@ -158,3 +158,15 @@ class LonelyTimeoutExpiringJob
158
158
  sleep 2
159
159
  end
160
160
  end
161
+
162
+ # Job that raises an error after its timeout.
163
+ class FailingAfterTimeoutJob
164
+ extend Resque::Plugins::LockTimeout
165
+ @queue = :test
166
+ @lock_timeout = 1
167
+
168
+ def self.perform
169
+ sleep 2
170
+ raise
171
+ end
172
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-lock-timeout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Antins
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-21 00:00:00.000000000 Z
13
+ date: 2015-08-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: resque
@@ -30,16 +30,16 @@ dependencies:
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ">="
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '0'
35
+ version: '10.3'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: '10.3'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: minitest
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.2.0
131
+ rubygems_version: 2.4.6
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: A Resque plugin adding locking, with optional timeout/deadlock handling to