switchman-inst-jobs 4.0.15 → 4.0.17

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: e78746649c51edcf059596423923bc4f42422108877a1c7444aa7985c7a55065
4
- data.tar.gz: c553969dbfb2b7bc796ad2b10c7589ef08fb063246601ad38a6484ab89486125
3
+ metadata.gz: 31b6b1d2dfe3070a63ed755c287ae3b744a42bf16fc57d62dcbc28569e8adeed
4
+ data.tar.gz: 7ab79f81effb0e8da6ee01efea3cb10920f601a5a007d6c55b784983b190f1b3
5
5
  SHA512:
6
- metadata.gz: b95a14b6122193c204642643608a7355cbdb2abb69fec3471021788c31bcd0ffccd1d811f69b86a5a4cda47c7a43b25eb22a59d5f13a6d73bb07cadf659246a0
7
- data.tar.gz: 693d7faaf636a13445c097d2faa0e5c45b0b1a31ed3245c0e43334f7dc19efd08bcc6491f1432e8afc17124edb433fc2cd06c61f9a4bf70ecb1e5f03e0d2b5ad
6
+ metadata.gz: f8e90f264c6027a3107313569d2d394724bde9a7e30fd1a9b57cafff248bafc8c0405b99018a126e6d7c94bdddda8ec803b080b4fbcb4f5e1b2abceb68f2d02a
7
+ data.tar.gz: e7935969ea9bfca9f67b6d133220e6355b264fca916bb003ce8e3e1c0134d77c1d2de59c162623ed783b19fd3c27faeab204a8984c72e3f79967ece531957b24
@@ -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
- shard_ids = @config[:workers].pluck(:shard).uniq
23
- shards = shard_ids.map { |shard_id| ::Delayed::Worker.shard(shard_id) }
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.all
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)))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwitchmanInstJobs
4
- VERSION = "4.0.15"
4
+ VERSION = "4.0.17"
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.0.15
4
+ version: 4.0.17
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-10-06 00:00:00.000000000 Z
11
+ date: 2025-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inst-jobs
@@ -68,16 +68,22 @@ dependencies:
68
68
  name: switchman
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: '3.1'
73
+ version: 3.5.14
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: '5.0'
74
77
  type: :runtime
75
78
  prerelease: false
76
79
  version_requirements: !ruby/object:Gem::Requirement
77
80
  requirements:
78
- - - "~>"
81
+ - - ">="
79
82
  - !ruby/object:Gem::Version
80
- version: '3.1'
83
+ version: 3.5.14
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '5.0'
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: bundler
83
89
  requirement: !ruby/object:Gem::Requirement
@@ -274,7 +280,7 @@ dependencies:
274
280
  - - "~>"
275
281
  - !ruby/object:Gem::Version
276
282
  version: '0.21'
277
- description:
283
+ description:
278
284
  email:
279
285
  - bpetty@instructure.com
280
286
  executables: []
@@ -353,7 +359,7 @@ licenses:
353
359
  metadata:
354
360
  allowed_push_host: https://rubygems.org
355
361
  rubygems_mfa_required: 'true'
356
- post_install_message:
362
+ post_install_message:
357
363
  rdoc_options: []
358
364
  require_paths:
359
365
  - lib
@@ -361,15 +367,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
361
367
  requirements:
362
368
  - - ">="
363
369
  - !ruby/object:Gem::Version
364
- version: '2.7'
370
+ version: '3.0'
365
371
  required_rubygems_version: !ruby/object:Gem::Requirement
366
372
  requirements:
367
373
  - - ">="
368
374
  - !ruby/object:Gem::Version
369
375
  version: '0'
370
376
  requirements: []
371
- rubygems_version: 3.1.6
372
- signing_key:
377
+ rubygems_version: 3.4.19
378
+ signing_key:
373
379
  specification_version: 4
374
380
  summary: Switchman and Instructure Jobs compatibility gem.
375
381
  test_files: []