switchman-inst-jobs 4.0.14 → 4.0.16
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: ffde0df8a9f25e9d0feeb77a63670fbbfd0f9dd3a407ed1f6419070f66c2674f
|
4
|
+
data.tar.gz: c31ecdea96e9759783ce4f3683eb57f7f156bd68f053537063cb10a5d4351dc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b324b5616dfbd26e6af0c3ce2182f3a2fa66423eb672b842b51f19b9088be7befd31484d5e1290990506d6867471ea38e9d6303cf233538589c8c2c0626b9e2
|
7
|
+
data.tar.gz: 7c7e9928a25641dd790464a77d04078d467a006e30dcb6dfcce8b24860cb0f441273e164679d5cdc3d718b5b21ff225aee013c71716a599e3985aa09853a5931
|
@@ -3,8 +3,17 @@
|
|
3
3
|
module SwitchmanInstJobs
|
4
4
|
module Delayed
|
5
5
|
module Pool
|
6
|
+
def initialize(*)
|
7
|
+
super
|
8
|
+
|
9
|
+
raise "Cannot run jobs cross-region" unless shards.all?(&:in_current_region?)
|
10
|
+
end
|
11
|
+
|
6
12
|
def unlock_orphaned_jobs(worker = nil, pid = nil)
|
7
13
|
if worker
|
14
|
+
# this is just a failsafe; it shouldn't be possible
|
15
|
+
return unless worker.shard.in_current_region?
|
16
|
+
|
8
17
|
shards = [worker.shard]
|
9
18
|
else
|
10
19
|
# Since we're not unlocking for a specific worker, look through
|
@@ -19,13 +28,18 @@ module SwitchmanInstJobs
|
|
19
28
|
# We purposely don't .compact to remove nils here, since if any
|
20
29
|
# workers are on the default jobs shard we want to unlock against
|
21
30
|
# that shard too.
|
22
|
-
|
23
|
-
shards =
|
31
|
+
|
32
|
+
shards = self.shards.select(&:in_current_region?)
|
24
33
|
end
|
25
34
|
::Switchman::Shard.with_each_shard(shards, [::Delayed::Backend::ActiveRecord::AbstractJob]) do
|
26
35
|
super
|
27
36
|
end
|
28
37
|
end
|
38
|
+
|
39
|
+
def shards
|
40
|
+
shard_ids = @config[:workers].pluck(:shard).uniq
|
41
|
+
shard_ids.map { |shard_id| ::Delayed::Worker.shard(shard_id) }
|
42
|
+
end
|
29
43
|
end
|
30
44
|
end
|
31
45
|
end
|
@@ -10,6 +10,9 @@ module SwitchmanInstJobs
|
|
10
10
|
def initialize(options = {})
|
11
11
|
# have to initialize this first, so #shard works
|
12
12
|
@config = options
|
13
|
+
# this shouldn't be possible because of the pool check, but just in case
|
14
|
+
raise "Cannot run jobs cross-region" unless shard.in_current_region?
|
15
|
+
|
13
16
|
::Delayed::Worker::HealthCheck.munge_service_name(shard) do
|
14
17
|
super
|
15
18
|
# ensure we get our own copy of the munged config
|
@@ -120,8 +120,7 @@ module SwitchmanInstJobs
|
|
120
120
|
scope = scope.or(::Switchman::Shard.unscoped.where(id: db_jobs_shards)) unless db_jobs_shards.empty?
|
121
121
|
|
122
122
|
if has_self
|
123
|
-
self_dbs = ::Switchman::DatabaseServer.
|
124
|
-
.select { |db| db.config[:delayed_jobs_shard] == "self" }.map(&:id)
|
123
|
+
self_dbs = ::Switchman::DatabaseServer.select { |db| db.config[:delayed_jobs_shard] == "self" }.map(&:id)
|
125
124
|
scope = scope.or(::Switchman::Shard.unscoped
|
126
125
|
.where(id: ::Switchman::Shard.unscoped.where(delayed_jobs_shard_id: nil, database_server_id: self_dbs)
|
127
126
|
.select(:id)))
|
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.16
|
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: 2023-
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inst-jobs
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
version: '6.1'
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '7.
|
56
|
+
version: '7.2'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
version: '6.1'
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '7.
|
66
|
+
version: '7.2'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: switchman
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,6 +71,9 @@ dependencies:
|
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '3.1'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.5.14
|
74
77
|
type: :runtime
|
75
78
|
prerelease: false
|
76
79
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -78,20 +81,9 @@ dependencies:
|
|
78
81
|
- - "~>"
|
79
82
|
- !ruby/object:Gem::Version
|
80
83
|
version: '3.1'
|
81
|
-
-
|
82
|
-
name: appraisal
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - "~>"
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: 2.3.0
|
88
|
-
type: :development
|
89
|
-
prerelease: false
|
90
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
requirements:
|
92
|
-
- - "~>"
|
84
|
+
- - ">="
|
93
85
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
86
|
+
version: 3.5.14
|
95
87
|
- !ruby/object:Gem::Dependency
|
96
88
|
name: bundler
|
97
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,7 +280,7 @@ dependencies:
|
|
288
280
|
- - "~>"
|
289
281
|
- !ruby/object:Gem::Version
|
290
282
|
version: '0.21'
|
291
|
-
description:
|
283
|
+
description:
|
292
284
|
email:
|
293
285
|
- bpetty@instructure.com
|
294
286
|
executables: []
|
@@ -367,7 +359,7 @@ licenses:
|
|
367
359
|
metadata:
|
368
360
|
allowed_push_host: https://rubygems.org
|
369
361
|
rubygems_mfa_required: 'true'
|
370
|
-
post_install_message:
|
362
|
+
post_install_message:
|
371
363
|
rdoc_options: []
|
372
364
|
require_paths:
|
373
365
|
- lib
|
@@ -382,8 +374,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
382
374
|
- !ruby/object:Gem::Version
|
383
375
|
version: '0'
|
384
376
|
requirements: []
|
385
|
-
rubygems_version: 3.
|
386
|
-
signing_key:
|
377
|
+
rubygems_version: 3.4.19
|
378
|
+
signing_key:
|
387
379
|
specification_version: 4
|
388
380
|
summary: Switchman and Instructure Jobs compatibility gem.
|
389
381
|
test_files: []
|