unique_job 0.3.0.pre → 0.3.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/unique_job/util.rb +6 -6
- data/lib/unique_job/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10d542ca656951df33aad35ccc2bc6a7084e817440b5350589f29d318200be78
|
4
|
+
data.tar.gz: 1c029a320d84f7dc509a0315c1420e07fac331119ea643b58b391516c0f14804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99507fb879e9708a1488081d7cc5b6115c77f2b38915a3a23e162b2b862ea090d5ffd368ac5fb777629523218529acf5635bc9fa47156b9c5de6e1d4e746393f
|
7
|
+
data.tar.gz: 34d3309e4c134e5e8b03bf931473b84722d9393fc42d581acde96bdf7e268b410a38073ba25b2b8d797e8394df6ca344bee3ed2eb5ed93905cea84a1f9721b4a
|
data/Gemfile.lock
CHANGED
data/lib/unique_job/util.rb
CHANGED
@@ -13,22 +13,22 @@ module UniqueJob
|
|
13
13
|
if unique_key.nil? || unique_key.to_s.empty?
|
14
14
|
logger.warn { "[UniqueJob] Don't check a job with a blank key worker=#{worker.class} key=#{unique_key}" }
|
15
15
|
yield
|
16
|
-
elsif
|
16
|
+
elsif check_uniqueness(worker, unique_key.to_s)
|
17
17
|
yield
|
18
|
+
else
|
19
|
+
logger.debug { "[UniqueJob] Duplicate job skipped worker=#{worker.class} key=#{unique_key}" }
|
20
|
+
perform_callback(worker, :after_skip, args)
|
21
|
+
nil
|
18
22
|
end
|
19
23
|
else
|
20
24
|
yield
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
24
|
-
def
|
28
|
+
def check_uniqueness(worker, unique_key)
|
25
29
|
history = job_history(worker)
|
26
30
|
|
27
31
|
if history.exists?(unique_key)
|
28
|
-
logger.info { "[UniqueJob] Skip duplicate job worker=#{worker.class} key=#{unique_key}" }
|
29
|
-
|
30
|
-
perform_callback(worker, :after_skip, args)
|
31
|
-
|
32
32
|
false
|
33
33
|
else
|
34
34
|
history.add(unique_key)
|
data/lib/unique_job/version.rb
CHANGED