switchman-inst-jobs 4.0.9 → 4.0.10

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: c6453b4fb5882411028c48e458ec49ee8dd14686b6baa889053bdc44c0f43ecc
4
- data.tar.gz: b5883129b65be01ce10acdb373bdd8bcc95c76e8a18eb4326cb2590b71ead518
3
+ metadata.gz: 9f11936008b976dcf8421f1e8c232c04f70e9e1883c9aff5f2191d838bca2155
4
+ data.tar.gz: d43598b5e9998f83564282b7900c696fd815c55cd80088e14f60c14d1a01d850
5
5
  SHA512:
6
- metadata.gz: adc1ed9eb64a227ecbe46f98f92e6b357c595249ad681a4dd3b649fade15b5848ebb4cf15feca35b49ca2c312abe31ef3357941f666be11ad554a1f5cc37892c
7
- data.tar.gz: f0d8cd82e01d15b698f57417f2b2d88cb0263bbd47cfba167a812158f89a5110e653590b3e125f65c5555e3f580f346bbf5f1de9b0a58cc8f951bd326d348e9e
6
+ metadata.gz: 0b00fb9a88dcec5e8c9d76175cb9de7194f107b98732cd27a46cfa63ecfd310d080055df26008f9301d16e9780e73ca6605e63ab30963d9a0753bd5b746fcf67
7
+ data.tar.gz: 5954e29022225b3f7dcf8c9f32c37f97cd0edc6db535753da7633f79167c72141fc96f479e9e334106540205eec91f0901344e0f369f98edec65638a21b9b621
@@ -39,7 +39,7 @@ module SwitchmanInstJobs
39
39
  updates[:updated_at] = Time.zone.now if ::Switchman::Shard.column_names.include?('updated_at')
40
40
  ::Switchman::Shard.where(id: shards).update_all(updates)
41
41
  end
42
- clear_shard_cache
42
+ clear_shard_cache(default: ::Switchman::Shard.exists?(id: target_shards.values.flatten, default: true))
43
43
 
44
44
  ::Switchman::Shard.clear_cache
45
45
  # rubocop:disable Style/CombinableLoops
@@ -62,7 +62,7 @@ module SwitchmanInstJobs
62
62
  return unless shards.any?
63
63
 
64
64
  ::Switchman::Shard.where(id: shards).update_all(block_stranded: false)
65
- clear_shard_cache
65
+ clear_shard_cache(default: shards.any?(&:default?))
66
66
 
67
67
  # shards is an array of shard objects that is now stale cause block_stranded has been updated.
68
68
  shards.map(&:delayed_jobs_shard).uniq.each do |dj_shard|
@@ -70,8 +70,9 @@ module SwitchmanInstJobs
70
70
  end
71
71
  end
72
72
 
73
- def clear_shard_cache(debug_message = nil)
74
- ::Switchman.cache.clear
73
+ def clear_shard_cache(debug_message = nil, default:)
74
+ ::Switchman.cache.delete_matched('shard/*')
75
+ ::Switchman.cache.delete('default_shard') if default
75
76
  Rails.logger.debug { "Waiting for caches to clear #{debug_message}" }
76
77
  # Wait a little over the 60 second in-process shard cache clearing
77
78
  # threshold to ensure that all new stranded jobs are now being
@@ -186,7 +187,11 @@ module SwitchmanInstJobs
186
187
  updated = ::Switchman::Shard.where(id: source_shard_ids, block_stranded: true).
187
188
  update_all(block_stranded: false)
188
189
  # If this is being manually re-run for some reason to clean something up, don't wait for nothing to happen
189
- clear_shard_cache("(#{source_shard.id} -> #{target_shard.id})") unless updated.zero?
190
+ unless updated.zero?
191
+ clear_shard_cache("(#{source_shard.id} -> #{target_shard.id})",
192
+ default: ::Switchman::Shard.exists?(id: source_shard_ids,
193
+ default: true))
194
+ end
190
195
 
191
196
  ::Switchman::Shard.clear_cache
192
197
  # At this time, let's unblock all the strands on the target shard that aren't being held by a blocker
@@ -1,3 +1,3 @@
1
1
  module SwitchmanInstJobs
2
- VERSION = '4.0.9'.freeze
2
+ VERSION = '4.0.10'.freeze
3
3
  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.0.9
4
+ version: 4.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Petty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inst-jobs