switchman-inst-jobs 3.1.1 → 3.1.2

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: 2a489d2a35d787be5492b4a5d710f1cc6560ad5c3d9f9ad965e0860338562d62
4
- data.tar.gz: 88d1ff219ce44f9cb50846c631261ed792f4ce78a8ebde00ea5b08b3a172bf2c
3
+ metadata.gz: 4efbe05e879c9162df06f945af688c64876b9c56cc870509687160549359fd39
4
+ data.tar.gz: e32c8a6dfecd0b6c760d07a4d45eeaf6651d6cc7e70e7b6418d82c5a112f70cd
5
5
  SHA512:
6
- metadata.gz: d0c0574bcb3b5e006072f67fcd6c6a4d892e8db919da73cf4edf4d8ac790c1481fd9777a6b6e6950934951efb647445ff756f59ee9ca663a5f5303588fa5a52b
7
- data.tar.gz: b2ffe5cc363ab95d407d21a6c76e486dc9e40dc18d52ceabff9639e6408a33f392c33260a0d243720832e9c760ea8f9c55a941b6b0c31ba8fdae1328308bc5ee
6
+ metadata.gz: 4fe0103d1b4bc305f0c85ba2135366968eb7c33bb6482b6d302dde9b9532db1d3d09fac64d90dad16fe6c6a438236ede5732d16a22d8538053d814010c9d2c87
7
+ data.tar.gz: feb2e546ee06bc38f964f58e63cfb59fdc25757952762ef8f8faf0521050d264e9f018ea8e6bb0131b277997d63035f68562cf45a7af13886fbfd80f481f5515
@@ -38,6 +38,7 @@ end
38
38
 
39
39
  require 'switchman_inst_jobs/active_record/connection_adapters/postgresql_adapter'
40
40
  require 'switchman_inst_jobs/active_record/migration'
41
+ require 'switchman_inst_jobs/delayed/settings'
41
42
  require 'switchman_inst_jobs/delayed/backend/base'
42
43
  require 'switchman_inst_jobs/delayed/message_sending'
43
44
  require 'switchman_inst_jobs/delayed/pool'
@@ -43,8 +43,7 @@ module SwitchmanInstJobs
43
43
  end
44
44
 
45
45
  def configured_shard_ids
46
- (::Delayed::Settings.worker_config.try(:[], 'workers') || []).
47
- map { |w| w['shard'] }.compact.uniq
46
+ ::SwitchmanInstJobs::Delayed::Settings.configured_shard_ids
48
47
  end
49
48
 
50
49
  def processes_locked_locally
@@ -0,0 +1,9 @@
1
+ module SwitchmanInstJobs
2
+ module Delayed
3
+ module Settings
4
+ def self.configured_shard_ids
5
+ (::Delayed::Settings.worker_config.try(:[], 'workers') || []).map { |w| w['shard'] }.compact.uniq
6
+ end
7
+ end
8
+ end
9
+ end
@@ -18,22 +18,23 @@ module SwitchmanInstJobs
18
18
  ::Delayed::Settings.worker_health_check_config['service_name'] = original_service_name
19
19
  end
20
20
 
21
- def reschedule_abandoned_jobs(call_super: false)
22
- shards = ::Switchman::Shard.delayed_jobs_shards.to_a
23
- call_super = shards.first if shards.length == 1
24
- unless call_super == false
25
- call_super.activate(:delayed_jobs) do
26
- return munge_service_name(call_super) { super() }
21
+ def reschedule_abandoned_jobs
22
+ shard_ids = ::SwitchmanInstJobs::Delayed::Settings.configured_shard_ids
23
+ shards = shard_ids.map { |shard_id| ::Delayed::Worker.shard(shard_id) }
24
+ ::Switchman::Shard.with_each_shard(shards, [:delayed_jobs]) do
25
+ dj_shard = ::Switchman::Shard.current(:delayed_jobs)
26
+ dj_shard.activate do
27
+ munge_service_name(dj_shard) do
28
+ # because this rescheduling process is running on every host, we need
29
+ # to make sure that it's functioning for each shard the current
30
+ # host is programmed to interact with, but ONLY for those shards.
31
+ # reading the config lets us iterate over any shards this host should
32
+ # work with and lets us pick the correct service name to identify which
33
+ # hosts are currently alive and valid via the health checks
34
+ super()
35
+ end
27
36
  end
28
37
  end
29
-
30
- ::Switchman::Shard.with_each_shard(shards, [:delayed_jobs], exception: :ignore) do
31
- shard = ::Switchman::Shard.current(:delayed_jobs)
32
- singleton = <<~SINGLETON
33
- periodic: Delayed::Worker::HealthCheck.reschedule_abandoned_jobs:#{shard.id}
34
- SINGLETON
35
- delay(singleton: singleton).reschedule_abandoned_jobs(call_super: shard)
36
- end
37
38
  end
38
39
  end
39
40
  end
@@ -1,3 +1,3 @@
1
1
  module SwitchmanInstJobs
2
- VERSION = '3.1.1'.freeze
2
+ VERSION = '3.1.2'.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: 3.1.1
4
+ version: 3.1.2
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: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inst-jobs
@@ -260,7 +260,7 @@ dependencies:
260
260
  - - "~>"
261
261
  - !ruby/object:Gem::Version
262
262
  version: '1.4'
263
- description:
263
+ description:
264
264
  email:
265
265
  - bpetty@instructure.com
266
266
  executables: []
@@ -303,6 +303,7 @@ files:
303
303
  - lib/switchman_inst_jobs/delayed/backend/base.rb
304
304
  - lib/switchman_inst_jobs/delayed/message_sending.rb
305
305
  - lib/switchman_inst_jobs/delayed/pool.rb
306
+ - lib/switchman_inst_jobs/delayed/settings.rb
306
307
  - lib/switchman_inst_jobs/delayed/worker.rb
307
308
  - lib/switchman_inst_jobs/delayed/worker/health_check.rb
308
309
  - lib/switchman_inst_jobs/engine.rb
@@ -319,7 +320,7 @@ homepage: https://github.com/instructure/switchman-inst-jobs
319
320
  licenses:
320
321
  - MIT
321
322
  metadata: {}
322
- post_install_message:
323
+ post_install_message:
323
324
  rdoc_options: []
324
325
  require_paths:
325
326
  - lib
@@ -334,8 +335,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
334
335
  - !ruby/object:Gem::Version
335
336
  version: '0'
336
337
  requirements: []
337
- rubygems_version: 3.1.4
338
- signing_key:
338
+ rubygems_version: 3.0.3
339
+ signing_key:
339
340
  specification_version: 4
340
341
  summary: Switchman and Instructure Jobs compatibility gem.
341
342
  test_files: []