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 +4 -4
- data/lib/switchman_inst_jobs.rb +1 -0
- data/lib/switchman_inst_jobs/delayed/backend/base.rb +1 -2
- data/lib/switchman_inst_jobs/delayed/settings.rb +9 -0
- data/lib/switchman_inst_jobs/delayed/worker/health_check.rb +15 -14
- data/lib/switchman_inst_jobs/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4efbe05e879c9162df06f945af688c64876b9c56cc870509687160549359fd39
|
4
|
+
data.tar.gz: e32c8a6dfecd0b6c760d07a4d45eeaf6651d6cc7e70e7b6418d82c5a112f70cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fe0103d1b4bc305f0c85ba2135366968eb7c33bb6482b6d302dde9b9532db1d3d09fac64d90dad16fe6c6a438236ede5732d16a22d8538053d814010c9d2c87
|
7
|
+
data.tar.gz: feb2e546ee06bc38f964f58e63cfb59fdc25757952762ef8f8faf0521050d264e9f018ea8e6bb0131b277997d63035f68562cf45a7af13886fbfd80f481f5515
|
data/lib/switchman_inst_jobs.rb
CHANGED
@@ -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
|
-
|
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
|
@@ -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
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
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.
|
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
|
+
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.
|
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: []
|