inst-jobs 2.4.6 → 2.4.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48186ffba65e38c8e10702a68c93d9b4bb7f8ea13f98a7175e6755a1e693595f
|
4
|
+
data.tar.gz: 8a6e51516ffeaaa31d8b3bcb07a25e859259b9e734c5a8e14af019d842a01ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385dcba329c82516cc6ac3b17aa7254cb427fce7d964c40c20ddd64c73a04af0cc687e4626e0dc2af890bf10ef1ec534f355e0dc8203416120c36ec453a9eb71
|
7
|
+
data.tar.gz: 42c9316bb0ab5ad237fb70719ddbfa9ba9dc7f4b8dfd75b13880e7be228f9a03b566eb94c0771bdd6672f92919b5c79db4dafd041b1194a3cd4a829a96c006c4
|
@@ -43,6 +43,11 @@ module Delayed
|
|
43
43
|
fn_name = connection.quote_table_name("half_md5_as_bigint")
|
44
44
|
connection.select_value("SELECT pg_try_advisory_xact_lock(#{fn_name}('#{lock_name}'));")
|
45
45
|
end
|
46
|
+
|
47
|
+
def advisory_lock(lock_name)
|
48
|
+
fn_name = connection.quote_table_name("half_md5_as_bigint")
|
49
|
+
connection.execute("SELECT pg_advisory_xact_lock(#{fn_name}('#{lock_name}'));")
|
50
|
+
end
|
46
51
|
end
|
47
52
|
|
48
53
|
def single_step_create(on_conflict: nil)
|
data/lib/delayed/version.rb
CHANGED
@@ -198,7 +198,7 @@ module Delayed
|
|
198
198
|
next unless jobs.first.locked_at < Time.now.utc - Settings.parent_process[:prefetched_jobs_timeout]
|
199
199
|
|
200
200
|
Delayed::Job.transaction do
|
201
|
-
Delayed::Job.
|
201
|
+
Delayed::Job.advisory_lock(Delayed::Job.prefetch_jobs_lock_name)
|
202
202
|
Delayed::Job.unlock(jobs)
|
203
203
|
end
|
204
204
|
@prefetched_jobs[worker_config] = []
|
@@ -210,7 +210,7 @@ module Delayed
|
|
210
210
|
next if jobs.empty?
|
211
211
|
|
212
212
|
Delayed::Job.transaction do
|
213
|
-
Delayed::Job.
|
213
|
+
Delayed::Job.advisory_lock(Delayed::Job.prefetch_jobs_lock_name)
|
214
214
|
Delayed::Job.unlock(jobs)
|
215
215
|
end
|
216
216
|
end
|