rocketjob 3.0.0.rc1 → 3.0.0.rc2

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
  SHA1:
3
- metadata.gz: 5e00bccf78b1addfe4e7714526085787e009c852
4
- data.tar.gz: bdeb1d7b808c5b589421086254f7f301837d513c
3
+ metadata.gz: 19ad2006dddc959c04abb5299e6cbdbf8601f54b
4
+ data.tar.gz: 453df16f28f68ab2ee760d5ebfbaa10241217295
5
5
  SHA512:
6
- metadata.gz: 0e1a31bdef5185bf7ba414d847d49037871a6b913e3eeda57b98f4a37101b93bd63de8f55c36cfa8ee4cf9fabf55486b01ac4d1ade391104067f45b06a31bb13
7
- data.tar.gz: 13289e381b6f879d5da29f0b633316b1b4888dac9c1f5df1bd1048bf91acd122f64ce9837edf5ef631f2f4e8811dde3a008c43bb953557a3560eba2ee25c10d8
6
+ metadata.gz: bb828a20755d818fbbecd8170de158485634dd032141100510d6758d81bd4641fb3bda747316265786a0528125e5019d06fa724f3eb26ec2de9892cd7b458d93
7
+ data.tar.gz: cf74c8c0f5878d389b4898414a2fc80e74fbae67cf27419d52c6c61493f5b7a7467e26718c504bbeeedd636d4ff7062dc3aef53816d443a95c30af9d3e287810
@@ -231,30 +231,7 @@ module RocketJob
231
231
  started!
232
232
  logger.info 'RocketJob Server started'
233
233
 
234
- stagger = true
235
- while running? || paused?
236
- SemanticLogger.silence(:info) do
237
- find_and_update(
238
- 'heartbeat.updated_at' => Time.now,
239
- 'heartbeat.workers' => worker_count
240
- )
241
- end
242
- if paused?
243
- workers.each(&:shutdown!)
244
- stagger = true
245
- end
246
-
247
- # In case number of threads has been modified
248
- adjust_workers(stagger)
249
- stagger = false
250
-
251
- # Stop server if shutdown indicator was set
252
- if self.class.shutdown? && may_stop?
253
- stop!
254
- else
255
- sleep Config.instance.heartbeat_seconds
256
- end
257
- end
234
+ run_workers
258
235
 
259
236
  logger.info 'Waiting for workers to stop'
260
237
  # Tell each worker to shutdown cleanly
@@ -285,6 +262,33 @@ module RocketJob
285
262
  end
286
263
  end
287
264
 
265
+ def run_workers
266
+ stagger = true
267
+ while running? || paused?
268
+ SemanticLogger.silence(:info) do
269
+ find_and_update(
270
+ 'heartbeat.updated_at' => Time.now,
271
+ 'heartbeat.workers' => worker_count
272
+ )
273
+ end
274
+ if paused?
275
+ workers.each(&:shutdown!)
276
+ stagger = true
277
+ end
278
+
279
+ # In case number of threads has been modified
280
+ adjust_workers(stagger)
281
+ stagger = false
282
+
283
+ # Stop server if shutdown indicator was set
284
+ if self.class.shutdown? && may_stop?
285
+ stop!
286
+ else
287
+ sleep Config.instance.heartbeat_seconds
288
+ end
289
+ end
290
+ end
291
+
288
292
  # Returns [Fixnum] number of workers (threads) that are alive
289
293
  def worker_count
290
294
  workers.count(&:alive?)
@@ -319,7 +323,7 @@ module RocketJob
319
323
  worker_count = max_workers - count
320
324
  logger.info "Starting #{worker_count} workers"
321
325
  worker_count.times.each do
322
- sleep (Config.instance.max_poll_seconds.to_f / max_workers) * (next_worker_id - 1) if stagger_workers
326
+ sleep (Config.instance.max_poll_seconds.to_f / max_workers) if stagger_workers
323
327
  return if shutdown?
324
328
  # Start worker
325
329
  begin
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module RocketJob #:nodoc
3
- VERSION = '3.0.0.rc1'
3
+ VERSION = '3.0.0.rc2'
4
4
  end
@@ -32,7 +32,7 @@ module RocketJob
32
32
  set_callback(:running, :around, *filters, &blk)
33
33
  end
34
34
 
35
- def initialize(id: 0, server_name: 'inline', inline: false, re_check_seconds: Config.instance.re_check_seconds, filter: nil)
35
+ def initialize(id: 0, server_name: 'inline:0', inline: false, re_check_seconds: Config.instance.re_check_seconds, filter: nil)
36
36
  @id = id
37
37
  @server_name = server_name
38
38
  if defined?(Concurrent::JavaAtomicBoolean) || defined?(Concurrent::CAtomicBoolean)
@@ -42,7 +42,7 @@ module RocketJob
42
42
  end
43
43
  @name = "#{server_name}:#{id}"
44
44
  @thread = Thread.new { run } unless inline
45
- @re_check_seconds = re_check_seconds
45
+ @re_check_seconds = re_check_seconds || 60
46
46
  @re_check_start = Time.now
47
47
  @filter = filter || {}
48
48
  @current_filter = @filter.dup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocketjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mongo_ha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
69
83
  description:
70
84
  email:
71
85
  - support@rocketjob.io