goat 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/state-srv +13 -0
- data/goat.gemspec +1 -1
- metadata +3 -3
data/bin/state-srv
CHANGED
@@ -26,6 +26,7 @@ module Goat
|
|
26
26
|
@components_by_id = {}
|
27
27
|
@components_by_page = {}
|
28
28
|
@last_connected = {}
|
29
|
+
@first_connected = {}
|
29
30
|
@page_connections = {}
|
30
31
|
@channelsrvs = {}
|
31
32
|
@page_versions = {}
|
@@ -52,6 +53,7 @@ module Goat
|
|
52
53
|
|
53
54
|
def initialize_page(pgid)
|
54
55
|
@page_versions[pgid] = 0
|
56
|
+
@first_connected[pgid] = Time.now
|
55
57
|
end
|
56
58
|
|
57
59
|
def incr_page_version(pgid)
|
@@ -88,6 +90,15 @@ module Goat
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
93
|
+
def first_connected_delta(pgid)
|
94
|
+
if connected = @first_connected[pgid]
|
95
|
+
Time.now - connected
|
96
|
+
else
|
97
|
+
$stderr.puts "ERROR: asked for first_connected_delta of #{pgid}, which I don't have"
|
98
|
+
Time.now - Time.at(0)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
91
102
|
def connected_pages
|
92
103
|
@page_connections.keys
|
93
104
|
end
|
@@ -199,9 +210,11 @@ module Goat
|
|
199
210
|
def live_components(msg)
|
200
211
|
ensure_keys(msg, %w{class spec})
|
201
212
|
|
213
|
+
# return newest components first
|
202
214
|
@registry.components_by_class(msg['class']).\
|
203
215
|
select{|c| c.spec == msg['spec']}.\
|
204
216
|
select{|c| @registry.connected?(c.pgid) || @registry.last_connected_delta(c.pgid) < 120}.\
|
217
|
+
sort_by{|c| @registry.first_connected_delta(c.pgid)}.\
|
205
218
|
map(&:to_hash)
|
206
219
|
end
|
207
220
|
|
data/goat.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Collison
|