gnomon 1.0.0 → 1.1.0

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: 2df2fb4bd5565c7a0e51b29646d1a403e6d083e9
4
- data.tar.gz: bd3ecdcfb103a8078f8fdc26a7c5becd2d278ae7
3
+ metadata.gz: f1e1ffd668a702bb8bc444c11d9035c3fb6e9365
4
+ data.tar.gz: ca4c4deb748c398dabc19b1143913ee641a2c321
5
5
  SHA512:
6
- metadata.gz: 0136237e49d7ca5b449e42320e26d5b416654cfee9f95adf4c8a4b3c0e29da9d0c2a2baef135b09deb0186c7e0ce00ab99ae9509f45b47f1300cc0b5cd0cb401
7
- data.tar.gz: aff7291a48f8d79739d4022d3dd165df498f23d1df6fc895596ed3e8284f2e749ba604ee860910d119517bfa31449b19d4e06228a667e58db3d966114fbacc3d
6
+ metadata.gz: c1263559b07cc99dc0d9d54d628aa22c74f98d6363265e3922f304673afff38f82197452d1981244742bec128f4e78407f0047bf32385fe54dcf0319d48cb2d9
7
+ data.tar.gz: 2cd3fd30fcf6047a93bcf87df5f2e76b89df4720a986e1056a9295b1ba8fe588a067f1a254316baff537882069602cc60cae28773cea419f943f450151d309ce
@@ -124,8 +124,14 @@ class Gnomon
124
124
  # Registers the next run for a given event into the event queue.
125
125
  # @param [Hash] event
126
126
  def enqueue_next_run event
127
+
128
+ # Determine Next Run
127
129
  next_run = next_run event[:mode], event[:ts]
128
- pos = @equeue.index { |p| p[:next_run] >= next_run } || 0
130
+
131
+ # Determine position in Event Queue
132
+ pos = @equeue.index { |p| p[:next_run] >= next_run } || @equeue.size
133
+
134
+ # Insert
129
135
  @equeue.insert pos, { next_run: next_run, event: event }
130
136
  end
131
137
 
@@ -156,7 +162,7 @@ class Gnomon
156
162
  def update
157
163
 
158
164
  # Synchronize { Trigger Next Event in Queue }
159
- @lock.synchronize { trigger @equeue.shift[:event] if @equeue.first && @equeue.first[:next_run] <= Time.now.to_f }
165
+ @lock.synchronize { trigger @equeue.shift[:event] while @equeue.first && @equeue.first[:next_run] <= Time.now.to_f }
160
166
 
161
167
  # Sleep
162
168
  sleep @granularity
@@ -5,5 +5,5 @@
5
5
  class Gnomon
6
6
 
7
7
  # Version
8
- VERSION = '1.0.0'
8
+ VERSION = '1.1.0'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnomon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler