herdst_worker 0.2.16 → 0.2.17
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 +2 -4
- data/lib/herdst_worker/queue/processor.rb +12 -8
- data/lib/herdst_worker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38eaf100a0f45339a420402ba0dd782cf4daa2338fe6f362c65a35dade5f3be9
|
|
4
|
+
data.tar.gz: d07205a7ea5857f3fe4b1906526cc87043bbe28668613bd1c7e472f08480251e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44cfd9d0daca7cf3baf25f38f556c2fa3b1590edc111dfff3b1ab65b1db7aac02e62448f9afea1b7da97d0c41bc5ad7fa4c64fe8c7aa5135dccf98345e5f9199
|
|
7
|
+
data.tar.gz: e1d21d8ab1e447768bc2453b724594c71e27daedff5d11333b658bc7d19c4db58b2f0b8f872b967e41d1cac68dbefb5bbd56fa0493441ca9a4a4fb27344affe8
|
|
@@ -69,11 +69,9 @@ module HerdstWorker
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
def stop(exit_code = 0)
|
|
72
|
-
|
|
73
|
-
self.logger.queue.warn "Application exiting (#{exit_code})"
|
|
72
|
+
self.logger.warn "Application exiting (#{exit_code})"
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
end
|
|
74
|
+
Kernel.exit(exit_code)
|
|
77
75
|
end
|
|
78
76
|
|
|
79
77
|
|
|
@@ -48,6 +48,10 @@ module HerdstWorker
|
|
|
48
48
|
self.poller.poll(:wait_time_seconds => self.queue_wait_time, :skip_delete => false) do |msg|
|
|
49
49
|
process_message(msg)
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
if self.processor_status == "stopped"
|
|
53
|
+
self.app.stop(0)
|
|
54
|
+
end
|
|
51
55
|
else
|
|
52
56
|
raise "Cannot start a queue which is not enabled"
|
|
53
57
|
end
|
|
@@ -117,32 +121,32 @@ module HerdstWorker
|
|
|
117
121
|
current_time = Time.now.utc.to_i
|
|
118
122
|
if (self.processor_status == "working") && (current_time >= self.restart_time)
|
|
119
123
|
runtime = current_time - self.start_time
|
|
120
|
-
self.app.logger.queue.warn "
|
|
124
|
+
self.app.logger.queue.warn "Preparing to stop after #{runtime} seconds of work"
|
|
121
125
|
set_status "stopping"
|
|
122
126
|
|
|
123
|
-
# On finishing wait for jobs to complete and then set status
|
|
124
|
-
# to idle
|
|
127
|
+
# On finishing wait for jobs to complete and then set status to idle
|
|
125
128
|
elsif self.processor_status == "finishing"
|
|
126
129
|
if self.job_count == 0
|
|
127
130
|
self.app.logger.queue.warn "Setting processor status to idle"
|
|
128
131
|
set_status "idle"
|
|
129
132
|
end
|
|
130
133
|
|
|
134
|
+
end
|
|
135
|
+
|
|
131
136
|
# On stopping wait for jobs to complete and then set status
|
|
132
137
|
# to stopped. Once stopped the polling will terminate.
|
|
133
|
-
|
|
138
|
+
if self.processor_status == "stopping"
|
|
134
139
|
if self.job_count == 0
|
|
135
140
|
self.app.logger.queue.warn "Setting processor status to stopped"
|
|
136
141
|
set_status "stopped"
|
|
137
142
|
end
|
|
138
|
-
|
|
139
143
|
end
|
|
140
144
|
|
|
145
|
+
# Once stopped exit the application
|
|
141
146
|
if self.processor_status == "stopped"
|
|
142
147
|
self.app.logger.queue.warn "Stopping polling, Service requested to stop"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
raise :stop_polling
|
|
148
|
+
|
|
149
|
+
throw :stop_polling
|
|
146
150
|
end
|
|
147
151
|
end
|
|
148
152
|
|