herdst_worker 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/herdst_worker/application/facade.rb +12 -0
- data/lib/herdst_worker/queue/processor.rb +6 -3
- data/lib/herdst_worker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1cb8f2fe78959dcc72ddb5262d5f775f7e2c8894e4cea3079df5574bc9afa469
|
|
4
|
+
data.tar.gz: 26a30f925cd508910027e86449fc2ed0832dd64232c94f1992b0743a6f108046
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72a91bfab0fd4e3c19a6c98eb5c1cbca69c0d07950165145ec15d9c877593f8a497d7c21b931d4ad356141edafe0908556612da24e574352289d38f6fcc9449c
|
|
7
|
+
data.tar.gz: 013a1ef632e3f4fb751399e86fb2004bef44bd84d3fcc17a22a11919f4ba986c2428ee8c48ed38e5c4de7d9fd427de9bc7cd29276e2c487fd69aa02469c3360b
|
|
@@ -74,6 +74,18 @@ module HerdstWorker
|
|
|
74
74
|
Kernel.exit(exit_code)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
+
|
|
78
|
+
def force_stop(delay = 1)
|
|
79
|
+
self.logger.warn "Application force stopping in #{delay} seconds."
|
|
80
|
+
process_id = "#{$$}"
|
|
81
|
+
|
|
82
|
+
Concurrent::ScheduledTask.execute(delay) do
|
|
83
|
+
self.logger.warn "Application force stopping."
|
|
84
|
+
|
|
85
|
+
system("kill -9 #{process_id}")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
77
89
|
|
|
78
90
|
def config_for(name)
|
|
79
91
|
self.config.config_for(name)
|
|
@@ -9,7 +9,7 @@ module HerdstWorker
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
attr_accessor :app, :enabled, :queue_url, :queue_wait_time, :poller
|
|
12
|
-
attr_accessor :start_time, :restart_time, :run_time
|
|
12
|
+
attr_accessor :start_time, :restart_time, :run_time, :force_stop_delay
|
|
13
13
|
attr_accessor :processor_status, :job_count, :max_jobs
|
|
14
14
|
attr_accessor :attempt_threshold, :visibility_timeout, :ignored_notifications
|
|
15
15
|
|
|
@@ -30,6 +30,7 @@ module HerdstWorker
|
|
|
30
30
|
|
|
31
31
|
# Set the start time
|
|
32
32
|
self.run_time = (3600 * 4) + (rand * 600).floor # Four hours + bit more (< 10 minutes)
|
|
33
|
+
self.force_stop_delay = 600 # 10 minutes
|
|
33
34
|
self.reset_time
|
|
34
35
|
|
|
35
36
|
# Start the processor as working
|
|
@@ -122,8 +123,10 @@ module HerdstWorker
|
|
|
122
123
|
if (self.processor_status == "working") && (current_time >= self.restart_time)
|
|
123
124
|
runtime = current_time - self.start_time
|
|
124
125
|
self.app.logger.queue.warn "Preparing to stop after #{runtime} seconds of work"
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
self.app.force_stop(self.force_stop_delay)
|
|
127
|
+
|
|
128
|
+
set_status "stopping"
|
|
129
|
+
|
|
127
130
|
# On finishing wait for jobs to complete and then set status to idle
|
|
128
131
|
elsif self.processor_status == "finishing"
|
|
129
132
|
if self.job_count == 0
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: herdst_worker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Herd.St
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|