switchman-inst-jobs 4.3.1 → 4.3.2

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: 3d126fdf9fae2bd957760dd1fdf1cac821e5103eb691fc2b293b3bda6170bb5c
4
- data.tar.gz: 977e7915aea7e1e389ad95c190e5ae749a868f869f1d28542ee264342f57b89e
3
+ metadata.gz: 024c887329179bac0f9961d4ee813225593d3012efdfcb90747dfc8013b470d3
4
+ data.tar.gz: bcc91999036a817920b7a529a84cbe4f7dffc51e3629f14910e6d9dc44ffef6f
5
5
  SHA512:
6
- metadata.gz: 407591bf52c6068c6133b1654a68ffacb4aae0c0d941f7bdab9536a682c70a0a3ca04017c68e61ac6475fbd75a0b7cb93c35b1ce94e6e54b69fb638020802225
7
- data.tar.gz: d5a69e5b56e07f4c90dcd5fea9f28f491c56f832acdd821b081ee5d3bb068af516b9ca114d464cda4f154edf4765b91c3d10c05f60b31c6612b5e72dca0c79ec
6
+ metadata.gz: 97ffa7cb9912e45e88330df7dc5ef8d56868f6c1ad09829dc331c9c973096fb82d4518a2b4873a1f6b1572cab5cac947e0a2132e630209aebe9f6f3d9da7e6c9
7
+ data.tar.gz: e48e3ad03914eac68efdcb8d5dde9cb2abc0e5f42d9ff883b035176d223838ccf8377b36561af493b7e8ace9a88192a562f651d0297b4d7142c75053fdfc6129
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddMigrateFromJobsShard < ActiveRecord::Migration[7.1]
4
+ def change
5
+ add_reference :switchman_shards, :migrate_from_delayed_jobs_shard, foreign_key: { to_table: :switchman_shards }, index: false, if_not_exists: true
6
+ end
7
+ end
@@ -39,17 +39,17 @@ module SwitchmanInstJobs
39
39
  source_shards = Hash.new([].freeze)
40
40
  target_shards = Hash.new([].freeze)
41
41
  # Also add any incomplete moves to the source shards to ensure we clean up appropriately
42
- ::Switchman::Shard.where.not(previous_delayed_jobs_shard_id: nil).find_each do |shard|
42
+ ::Switchman::Shard.where.not(migrate_from_delayed_jobs_shard_id: nil).find_each do |shard|
43
43
  effective_map[shard.id] ||= shard.delayed_jobs_shard.id
44
44
  end
45
45
  effective_map.each do |(shard, target_shard)|
46
46
  shard = ::Switchman::Shard.find(shard) unless shard.is_a?(::Switchman::Shard)
47
47
  target_shard = target_shard.try(:id) || target_shard
48
48
  # if a move was interrupted, the new shard is already set as the delayed_jobs_shard
49
- # but we still have the old shard stored in previous_delayed_jobs_shard and should
49
+ # but we still have the old shard stored in migrate_from_delayed_jobs_shard and should
50
50
  # act as if we are moving from there in the first place
51
- if shard.previous_delayed_jobs_shard_id && shard.delayed_jobs_shard.id == target_shard
52
- source_shards[shard.previous_delayed_jobs_shard_id] += [shard.id]
51
+ if shard.migrate_from_delayed_jobs_shard_id && shard.delayed_jobs_shard.id == target_shard
52
+ source_shards[shard.migrate_from_delayed_jobs_shard_id] += [shard.id]
53
53
  else
54
54
  source_shards[shard.delayed_jobs_shard.id] += [shard.id]
55
55
  end
@@ -63,7 +63,7 @@ module SwitchmanInstJobs
63
63
  ::Switchman::Shard.transaction do
64
64
  # Do the updates in batches and then just clear redis instead of clearing them one at a time
65
65
  source_shards.each do |source_shard, shards|
66
- updates = { previous_delayed_jobs_shard_id: source_shard }
66
+ updates = { migrate_from_delayed_jobs_shard_id: source_shard }
67
67
  ::Switchman::Shard.where(id: shards).update_all(updates)
68
68
  end
69
69
  target_shards.each do |target_shard, shards|
@@ -86,7 +86,7 @@ module SwitchmanInstJobs
86
86
  end
87
87
  ensure_unblock_stranded_for(effective_map.map(&:first))
88
88
  # rubocop:enable Style/CombinableLoops
89
- ::Switchman::Shard.where(id: effective_map.map(&:first)).update_all(previous_delayed_jobs_shard_id: nil)
89
+ ::Switchman::Shard.where(id: effective_map.map(&:first)).update_all(migrate_from_delayed_jobs_shard_id: nil)
90
90
  end
91
91
 
92
92
  # if :migrate_strands ran on any shards that fell into scenario 1, then
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwitchmanInstJobs
4
- VERSION = "4.3.1"
4
+ VERSION = "4.3.2"
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.3.1
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Petty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-20 00:00:00.000000000 Z
11
+ date: 2026-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inst-jobs
@@ -136,7 +136,7 @@ files:
136
136
  - db/migrate/20220203063200_remove_old_singleton_index.rb
137
137
  - db/migrate/20220328152900_add_failed_jobs_indicies.rb
138
138
  - db/migrate/20220519204546_add_requeued_job_id_to_failed_jobs.rb
139
- - db/migrate/20260120092005_add_previous_jobs_shard.rb
139
+ - db/migrate/20260120092005_add_migrate_from_jobs_shard.rb
140
140
  - lib/switchman-inst-jobs.rb
141
141
  - lib/switchman_inst_jobs.rb
142
142
  - lib/switchman_inst_jobs/active_record/connection_adapters/postgresql_adapter.rb
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddPreviousJobsShard < ActiveRecord::Migration[7.1]
4
- def change
5
- add_reference :switchman_shards, :previous_delayed_jobs_shard, foreign_key: { to_table: :switchman_shards }, index: false, if_not_exists: true
6
- end
7
- end