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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0ea373d5be1e2b83c65048f8d24f34c942ebabc
4
- data.tar.gz: b0c58d16d5c69ccc221527e134a1ab74172c8ec3
3
+ metadata.gz: c24dc6715b65ec7c9670dd3c8753291eed88bcdd
4
+ data.tar.gz: 9b5d46e495137a629ad37b5680b35c877d3f7b7f
5
5
  SHA512:
6
- metadata.gz: 2e27fd24735fbcd7ef96be80f9dcbbb925bf322c17a3902c76f5a9ad04a37039dc6dacd0c1661eec07a5cc400b9757ed938b93f45d6f61e80f8fb8f1885dd006
7
- data.tar.gz: 16ad3bfc0d0fc4c73ca135715f3ce73f4bd374897d830d1f9a564a6edaa59787cd280c14f3acb77bea61813a32ebd2fdfebfb02f6b6d3cbd2a133020e2d4c667
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 unless EventMachine.reactor_running?
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
@@ -1,3 +1,3 @@
1
1
  module Pubsubstub
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubsubstub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Malette