switchman-inst-jobs 3.2.9 → 3.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/switchman_inst_jobs/jobs_migrator.rb +12 -3
- data/lib/switchman_inst_jobs/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: c7c79b622db6622d52f9fa4bc58b4b4bcd199ac246c93af1330b93f724ecec6b
|
4
|
+
data.tar.gz: efa9db49c224a20c03cdb28e4c97b4071864bb8b2d7efd6c16469eeb6a32544a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3978fd1d2abc5f0adda8caeb77891153eda538e470712a2472268b104e989c573851a110db6a1e60c894a95b21ba66a348b403dcab68684e762765b8952729b8
|
7
|
+
data.tar.gz: 67dfe54fc06dcf591b129d6aeda70c9019400696a3052b12e43d043a943dcd2db52f962de05acc45125e6f2824d99d9d9c72e6db4232b31adcaf9c3c1ade0512
|
@@ -127,7 +127,13 @@ module SwitchmanInstJobs
|
|
127
127
|
# the lock ensures the blocker always gets unlocked
|
128
128
|
first = value_scope.where.not(locked_by: nil).next_in_strand_order.lock.first
|
129
129
|
if first
|
130
|
-
create_blocker_job(
|
130
|
+
create_blocker_job(
|
131
|
+
queue: first.queue,
|
132
|
+
shard_id: first.shard_id,
|
133
|
+
**{ column => value },
|
134
|
+
**blocker_job_kwargs
|
135
|
+
)
|
136
|
+
|
131
137
|
# the rest of 3) is taken care of here
|
132
138
|
# make sure that all the jobs moved over are NOT next in strand
|
133
139
|
::Delayed::Job.where(next_in_strand: true, locked_by: nil, **{ column => value }).
|
@@ -160,12 +166,15 @@ module SwitchmanInstJobs
|
|
160
166
|
locked_by: ::Delayed::Backend::Base::ON_HOLD_BLOCKER
|
161
167
|
}
|
162
168
|
|
169
|
+
quoted_function_name = ::Delayed::Job.connection.quote_table_name('half_md5_as_bigint')
|
163
170
|
strand_advisory_lock_fn = lambda do |value|
|
164
|
-
::Delayed::Job.connection.execute("SELECT pg_advisory_xact_lock(
|
171
|
+
::Delayed::Job.connection.execute("SELECT pg_advisory_xact_lock(#{quoted_function_name}('#{value}'))")
|
165
172
|
end
|
166
173
|
|
167
174
|
singleton_advisory_lock_fn = lambda do |value|
|
168
|
-
::Delayed::Job.connection.execute(
|
175
|
+
::Delayed::Job.connection.execute(
|
176
|
+
"SELECT pg_advisory_xact_lock(#{quoted_function_name}('singleton:#{value}'))"
|
177
|
+
)
|
169
178
|
end
|
170
179
|
|
171
180
|
handler.call(strand_scope, :strand, {}, strand_advisory_lock_fn)
|