pubsubstub 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubsubstub/stream_action.rb +3 -4
- data/lib/pubsubstub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c24dc6715b65ec7c9670dd3c8753291eed88bcdd
|
4
|
+
data.tar.gz: 9b5d46e495137a629ad37b5680b35c877d3f7b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cc525b5961d9887ae419b21643507dc10710d98732209e6d0b0c5e27a384e8e1367ccd25a5acdbe9fcd2450a4ad836b402d4485797f50d3f0c84b44a39f6667
|
7
|
+
data.tar.gz: 7c3578a6f8ca36b5669a793029e5ba0e172d8fd212218a1ab0242a0dece81456927b0ab235e85bb4abbf68188b4be8cc84b74818b54139402f715ccc8cc68425
|
@@ -4,7 +4,6 @@ module Pubsubstub
|
|
4
4
|
|
5
5
|
def initialize(*)
|
6
6
|
super
|
7
|
-
start_heartbeat
|
8
7
|
end
|
9
8
|
|
10
9
|
get '/', provides: 'text/event-stream' do
|
@@ -17,6 +16,7 @@ module Pubsubstub
|
|
17
16
|
|
18
17
|
if EventMachine.reactor_running?
|
19
18
|
subscribe_connection
|
19
|
+
start_heartbeat
|
20
20
|
else
|
21
21
|
return_scrollback
|
22
22
|
end
|
@@ -62,9 +62,8 @@ module Pubsubstub
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def start_heartbeat
|
65
|
-
return
|
66
|
-
EventMachine::PeriodicTimer.new(Pubsubstub.heartbeat_frequency) do
|
67
|
-
sleep Pubsubstub.heartbeat_frequency
|
65
|
+
return if @timer
|
66
|
+
@timer = EventMachine::PeriodicTimer.new(Pubsubstub.heartbeat_frequency) do
|
68
67
|
event = heartbeat_event.to_message
|
69
68
|
@connections.each { |connection| connection << event }
|
70
69
|
end
|
data/lib/pubsubstub/version.rb
CHANGED