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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3bcca0fea942c15752e9a0c7f56f1b0d9a333d9fbe0fcef1cd4b722a0333f72
4
- data.tar.gz: b9868c69103c6b4947b66fe801775c824a848ba0d4cb9ee8284b01593e593996
3
+ metadata.gz: 38eaf100a0f45339a420402ba0dd782cf4daa2338fe6f362c65a35dade5f3be9
4
+ data.tar.gz: d07205a7ea5857f3fe4b1906526cc87043bbe28668613bd1c7e472f08480251e
5
5
  SHA512:
6
- metadata.gz: e891b196b8418014c671b15fe48498ad7785820ea9dc99c3d1b1ca2a5ab693b822cd006f017b1c6221e747ca4b08eec163be7bc00644327024d3972509ca5302
7
- data.tar.gz: 055ead61ea81ac0025d3e539ae69633031b3fd09b288476eb5f82d6be2eeca504c4d9af8ac81c1d6a51dd5bd01c717f35475844a1ca7d14f567fb10c99049136
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
- Concurrent::ScheduledTask.execute(5) do
73
- self.logger.queue.warn "Application exiting (#{exit_code})"
72
+ self.logger.warn "Application exiting (#{exit_code})"
74
73
 
75
- exit(exit_code)
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 "Stopping after #{runtime} seconds of work"
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
- elsif self.processor_status == "stopping"
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
- self.app.stop(1)
144
-
145
- raise :stop_polling
148
+
149
+ throw :stop_polling
146
150
  end
147
151
  end
148
152
 
@@ -1,3 +1,3 @@
1
1
  module HerdstWorker
2
- VERSION = '0.2.16'
2
+ VERSION = '0.2.17'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herdst_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herd.St