serial_scheduler 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: bf2bb48be1da2941f3915c657b2dbd69f76ccf3b56dc8f4584039ceafdd4b21e
4
- data.tar.gz: ed2bbab92b34219fddda684dcf711fe232cae3a4de930996fb1c54e0327a6d0d
3
+ metadata.gz: c3a506d86f511afd425f534d8c5751c3c4681325bafe00cb88e6fc9cef072ad6
4
+ data.tar.gz: c7bc9f006d4234ae1c2c138d8eba1836fb395dda9fe01a244e092ab8435b4266
5
5
  SHA512:
6
- metadata.gz: bb2324b9c72bf10503036b998ebd8a1d23495d7803c03d9a5ef666f9c6d20001b8c5da6f29ccb16453546aa3672888689f10345bd33d033618810156bd332a8f
7
- data.tar.gz: 57ab3749c5134eabd8926efba5cf673bb1b7023210c64c1a0f6a6b466e364f7172803b2b40618998d3e5dd7963eba0b1dce70148de786ee7c8cba1adbe0e7aa6
6
+ metadata.gz: bd3b75323b5b0462bf4e7c96c0a33b9f1490c3247f4b2d77d89c0843ab407df91f0a29d75a008df646a6698c1059a6af098fb3ce616a2d30540dfa2de598a702
7
+ data.tar.gz: 30b5de606989d0f1700f84f55e03b3cb9c051cab56acbd398940dba3d92e926b9fdd82b5f7f05d8d8509734dd2020bfed3aff182240caa78e03031bcd2d02335
@@ -64,12 +64,12 @@ class SerialScheduler
64
64
  now = Time.now.to_i
65
65
  earliest = @producers.min_by(&:next)
66
66
  wait = [earliest.next - now, 0].max # do not wait when overdue
67
+ target = Time.at(now + wait)
67
68
 
68
69
  if wait > 0
69
- @logger.info message: "Waiting to start job", job: earliest.name, in: wait, at: Time.at(now + wait).to_s
70
- wait.times do
71
- break if @stopped
72
-
70
+ @logger.info message: "Waiting to start job", job: earliest.name, in: wait, at: target.to_s
71
+ loop do
72
+ break if @stopped || Time.now >= target # need to re-check or long waits will drift by .3%
73
73
  sleep 1
74
74
  end
75
75
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  class SerialScheduler
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serial_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-14 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fugit