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 +4 -4
- data/lib/gnomon.rb +8 -2
- data/lib/gnomon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1e1ffd668a702bb8bc444c11d9035c3fb6e9365
|
4
|
+
data.tar.gz: ca4c4deb748c398dabc19b1143913ee641a2c321
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1263559b07cc99dc0d9d54d628aa22c74f98d6363265e3922f304673afff38f82197452d1981244742bec128f4e78407f0047bf32385fe54dcf0319d48cb2d9
|
7
|
+
data.tar.gz: 2cd3fd30fcf6047a93bcf87df5f2e76b89df4720a986e1056a9295b1ba8fe588a067f1a254316baff537882069602cc60cae28773cea419f943f450151d309ce
|
data/lib/gnomon.rb
CHANGED
@@ -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
|
-
|
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]
|
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
|
data/lib/gnomon/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|