switchman-inst-jobs 4.0.5 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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: 61fb55d3fff48ff95a3fae70acc49935250642ac4b2b24d3ece10e9d5624e1dd
|
4
|
+
data.tar.gz: 8544c358faaa63992a5db35db5d1d2a7317048349d91857d9b0241b02ec30b13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4601a44b1c795edb3302f5b9174292ff7724315cdb321a0fd9213f44eb72e3ffb0d48195f03426c7701eb32232b550f8bff325ea48f2f89133c7ba2e8039653
|
7
|
+
data.tar.gz: 8651595cec7bf1f67544e33fe806f1f082fe26809fdadacb7ad86ebfb885436db5c9333e09a1d4c320fc52dee7b1b942fe646524e1ee45d8db62b88b3f116397
|
@@ -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)
|