sidekiq-superworker 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Sidekiq
|
|
17
17
|
raise "Job has nil jid: #{item}" if item['jid'].nil?
|
18
18
|
|
19
19
|
subjob = find_subjob_by_jid(item['jid'])
|
20
|
-
SuperjobProcessor.error(subjob.superjob_id, worker, item, exception)
|
20
|
+
SuperjobProcessor.error(subjob.superjob_id, worker, item, exception) if subjob
|
21
21
|
end
|
22
22
|
|
23
23
|
protected
|
@@ -29,13 +29,16 @@ module Sidekiq
|
|
29
29
|
SubjobProcessor.complete(subjob) if subjob
|
30
30
|
end
|
31
31
|
|
32
|
+
# The job may've been created outside of sidekiq-superworker, so a nil return value for
|
33
|
+
# this method isn't necessarily problematic
|
32
34
|
def find_subjob_by_jid(jid)
|
33
35
|
# The job may complete before the Subjob record is created; in case that happens,
|
34
36
|
# we need to sleep briefly and requery.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
max_tries = 5
|
38
|
+
try = 0
|
39
|
+
while !(subjob = Subjob.find_by_jid(jid)) && try < max_tries
|
40
|
+
sleep 2 ** try
|
41
|
+
try += 1
|
39
42
|
end
|
40
43
|
subjob
|
41
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-superworker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|