switchman-inst-jobs 4.1.0 → 4.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a05ca311e09076da7e5fdb4cab4dc9100f2c43f63fd4607b263f23511c694aee
4
- data.tar.gz: 27808a1eb26baa6729e176ca9d0be90b885cd0f48f75c52b5148296d9b9a7583
3
+ metadata.gz: e1c01e6bdfd2a5cd3ddd756936a2793526c8e8860883bcd1ea8caa9febad979d
4
+ data.tar.gz: 4998d1686e5dfceffb5c1a41dcf0959266c8caf73bd99aa0e50e89523e41ba51
5
5
  SHA512:
6
- metadata.gz: ea7694250731e90416a1b826b7728600ecd299da0f704434ec06d81b3c0ade0012f29f06a9f7e78b1cf727f39a3e5052547fbe3d5d8683ac54ae804ea37e0de1
7
- data.tar.gz: 3ef9c702ae77152b6576ed21828dbd97388bd1d1f87efcc104ead778bb9503f129ad5515cab5fafa6371bc96026d2f18ab3c0f818fe4d92bada28b082156c02d
6
+ metadata.gz: aae64990ef75016c24ded178bf0edcf4b4343499b6d226d6c86104d9d15d23bd7a77acf35e622aff989e3292d0abf59bd15d4dd3d20e11e4f9e66e4fe393e581
7
+ data.tar.gz: 854dd08052ca1b042646ce2fd08c4c0f76d2f5075f11ecebf34f04f8293c3ab2c8d9977817adf2b5e0f6e4c67a6726e49bd4dc9d491b961a391588e78c22a274
@@ -230,14 +230,16 @@ module SwitchmanInstJobs
230
230
  blocked_shard_ids = blocked_shards.pluck(:id)
231
231
  query = lambda { |column, scope|
232
232
  ::Delayed::Job
233
- .where(id: ::Delayed::Job.select("DISTINCT ON (#{column}) id")
234
- .where(scope)
233
+ .where(id: ::Delayed::Job
234
+ .with(all_col: ::Delayed::Job.and(scope).distinct.select(column))
235
+ .with(blocked_col: ::Delayed::Job.from("all_col").select(column).where.not(
236
+ ::Delayed::Job.select(1)
237
+ .where(next_in_strand: true).or(::Delayed::Job.where(source: "JobsMigrator::StrandBlocker"))
238
+ .where("#{column} = all_col.#{column}").arel.exists
239
+ ))
240
+ .select("DISTINCT ON (#{column}) id")
235
241
  .where.not(shard_id: blocked_shard_ids)
236
- .where(
237
- ::Delayed::Job.select(1).from("#{::Delayed::Job.quoted_table_name} dj2")
238
- .where("dj2.next_in_strand = true OR dj2.source = 'JobsMigrator::StrandBlocker'")
239
- .where("dj2.#{column} = delayed_jobs.#{column}").arel.exists.not
240
- )
242
+ .where({ column => ::Delayed::Job.from("blocked_col").select(column) })
241
243
  .order(column, :strand_order_override, :id)).limit(batch_size)
242
244
  }
243
245
 
@@ -249,12 +251,13 @@ module SwitchmanInstJobs
249
251
  # batches
250
252
 
251
253
  loop do
252
- break if query.call(:strand, "strand IS NOT NULL").update_all(next_in_strand: true).zero?
254
+ break if query.call(:strand, ::Delayed::Job.where.not(strand: nil)).update_all(next_in_strand: true).zero?
253
255
  end
254
256
 
255
257
  loop do
256
258
  break if query.call(:singleton,
257
- "strand IS NULL AND singleton IS NOT NULL").update_all(next_in_strand: true).zero?
259
+ ::Delayed::Job.where(strand: nil)
260
+ .where.not(singleton: nil)).update_all(next_in_strand: true).zero?
258
261
  end
259
262
  end
260
263
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwitchmanInstJobs
4
- VERSION = "4.1.0"
4
+ VERSION = "4.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman-inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Petty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-24 00:00:00.000000000 Z
11
+ date: 2025-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inst-jobs