resque-workers-lock 2.0.0 → 2.0.1

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: 46137f8bebbbe0ced3b3c8bc255ecdc72fb718e3
4
- data.tar.gz: d2185948f051bbc073ae22a1f41782f985dd3ad5
3
+ metadata.gz: a240599f0ecc2716892ae8eb45e7abe12f2687b8
4
+ data.tar.gz: 37ba38c9cb774ebf4fc293813800a99ac257d3b9
5
5
  SHA512:
6
- metadata.gz: 3f0aa3cc230357b85e8ba84e4fb8230dceb3bee78d39c7eb764dd93c35267b587f2f39f38efe83561fff19e027c988ed8c6ab7071d9cbd2ff4ac06b414884251
7
- data.tar.gz: 4f4920fcfc473b25589cfa07e75d7cd5c473fa49baad5827f0f94a88f93e7d031e07e1053d5e698ef7e9aa46eb36cf7fe0e81d83ed851d464d24ccfd9bacc076
6
+ metadata.gz: 005617d1f3650acf154d8c355a48d53c70906d61fad31cefbffb18adaaab7ba01497c55a57c674189ff38f2f95a42eac7c0d0671339ba7a7d9c9a5f1127c4d41
7
+ data.tar.gz: 7c188eea29e6543b9eed0f1774bac4de11cecb5338e1d25e03b6bad927a976c3bccc148cfcff69fbdbeb8c0e7dbb1c9338a63d96f4f7f83ab2c9c8bf967fd83d
@@ -41,6 +41,18 @@ module Resque
41
41
  1.0
42
42
  end
43
43
 
44
+ # Override in your job to change the way how job is reenqueued
45
+ def reenqueue(*args)
46
+ if defined? Resque::Scheduler
47
+ # schedule a job in requeue_perform_delay seconds
48
+ Resque.enqueue_in(requeue_perform_delay, self, *args)
49
+ else
50
+ sleep(requeue_perform_delay)
51
+ Resque.enqueue(self, *args)
52
+ end
53
+ raise Resque::Job::DontPerform
54
+ end
55
+
44
56
  # Called with the job args before perform.
45
57
  # If it raises Resque::Job::DontPerform, the job is aborted.
46
58
  def before_perform_workers_lock(*args)
@@ -52,9 +64,7 @@ module Resque
52
64
  Resque.redis.expire(lock, worker_lock_timeout(*args))
53
65
  end
54
66
  else
55
- sleep(requeue_perform_delay)
56
- Resque.enqueue(self, *args)
57
- raise Resque::Job::DontPerform
67
+ reenqueue(*args)
58
68
  end
59
69
  end
60
70
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-workers-lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Olsthoorn
8
8
  - Mike Nicholaides
9
9
  - Jason Garber
10
10
  - Tijs Planckaert
11
+ - Anton Bogdanovich
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2014-05-30 00:00:00.000000000 Z
15
+ date: 2016-02-19 00:00:00.000000000 Z
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
17
18
  name: resque
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  version: '0'
78
79
  requirements: []
79
80
  rubyforge_project:
80
- rubygems_version: 2.2.2
81
+ rubygems_version: 2.4.6
81
82
  signing_key:
82
83
  specification_version: 4
83
84
  summary: Resque plugin, prevent specific jobs to be processed simultaneously by multiple