switchman-inst-jobs 4.0.7 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f11936008b976dcf8421f1e8c232c04f70e9e1883c9aff5f2191d838bca2155
|
4
|
+
data.tar.gz: d43598b5e9998f83564282b7900c696fd815c55cd80088e14f60c14d1a01d850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b00fb9a88dcec5e8c9d76175cb9de7194f107b98732cd27a46cfa63ecfd310d080055df26008f9301d16e9780e73ca6605e63ab30963d9a0753bd5b746fcf67
|
7
|
+
data.tar.gz: 5954e29022225b3f7dcf8c9f32c37f97cd0edc6db535753da7633f79167c72141fc96f479e9e334106540205eec91f0901344e0f369f98edec65638a21b9b621
|
@@ -14,7 +14,7 @@ module SwitchmanInstJobs
|
|
14
14
|
module ClassMethods
|
15
15
|
def enqueue(object, **options)
|
16
16
|
::Switchman::Shard.periodic_clear_shard_cache
|
17
|
-
current_shard = ::Switchman::Shard.current
|
17
|
+
current_shard = options[:current_shard] || ::Switchman::Shard.current
|
18
18
|
enqueue_options = options.merge(
|
19
19
|
current_shard: current_shard
|
20
20
|
)
|
@@ -35,8 +35,10 @@ module SwitchmanInstJobs
|
|
35
35
|
enqueue_options[:next_in_strand] = false
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
current_shard.activate do
|
39
|
+
current_job_shard.activate(::Delayed::Backend::ActiveRecord::AbstractJob) do
|
40
|
+
enqueue_job.call
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -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.
|
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
|
-
|
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
|
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.
|
4
|
+
version: 4.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Petty
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inst-jobs
|
@@ -288,7 +288,7 @@ dependencies:
|
|
288
288
|
- - "~>"
|
289
289
|
- !ruby/object:Gem::Version
|
290
290
|
version: '0.21'
|
291
|
-
description:
|
291
|
+
description:
|
292
292
|
email:
|
293
293
|
- bpetty@instructure.com
|
294
294
|
executables: []
|
@@ -367,7 +367,7 @@ licenses:
|
|
367
367
|
metadata:
|
368
368
|
allowed_push_host: https://rubygems.org
|
369
369
|
rubygems_mfa_required: 'true'
|
370
|
-
post_install_message:
|
370
|
+
post_install_message:
|
371
371
|
rdoc_options: []
|
372
372
|
require_paths:
|
373
373
|
- lib
|
@@ -383,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
383
383
|
version: '0'
|
384
384
|
requirements: []
|
385
385
|
rubygems_version: 3.1.6
|
386
|
-
signing_key:
|
386
|
+
signing_key:
|
387
387
|
specification_version: 4
|
388
388
|
summary: Switchman and Instructure Jobs compatibility gem.
|
389
389
|
test_files: []
|