tamashii-manager 0.2.5 → 0.2.6

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: e261e9f42acf76a96f678f43a6c95d6ca206680c
4
- data.tar.gz: e1a3c8fa43ecbd156abff71ba9d1a73a39cf79a1
3
+ metadata.gz: ac1ebd7c889445d0d94b3decf760092788a707cb
4
+ data.tar.gz: 92f09efb05a13bfc46dc6e55fc8d2f9efe5fc125
5
5
  SHA512:
6
- metadata.gz: 407385d718724a79a0aad75aeeba1ebe8cdf6ed363fff05683a57d16244d3f9caa04698961caf3e1671e27f95f096f32542873861aa24167ca3747249d23c541
7
- data.tar.gz: e1494e24c0ffa4a5bd6789ab9ff5d2dd9b2cf6fbabc955f6615404b6fea13dad0d7e2e1849e41990b909d8eae51257e1002dafd595f25ad366d95d77975e35f6
6
+ metadata.gz: 58ce54569eb0eabd4912bcba34330596b46fae9a737ce10b3e93cae0ec31795796eddffda0b845108c505f8631bf7ec63044d04de4b88e19359e45cd869cccd4
7
+ data.tar.gz: dbd23546a08693da78e344a3611e9b29d704246af71bea6d1a8fbb1b54307b26e27cb039e69702a6f99a986530d61f2b20fba4eb903666aa6e2d3f7583bb76f3
@@ -63,6 +63,7 @@ module Tamashii
63
63
  end
64
64
 
65
65
  def on_open
66
+ Client.ensure_heartbeat_enabled(@event_loop)
66
67
  Manager.logger.info("Client #{id} is ready")
67
68
  end
68
69
 
@@ -29,6 +29,12 @@ module Tamashii
29
29
  def send_to(id, packet)
30
30
  Manager.server.pubsub.send_to(id, packet)
31
31
  end
32
+
33
+ def ensure_heartbeat_enabled(event_loop)
34
+ @heartbeat_timer = event_loop.timer(Config.heartbeat_interval) do
35
+ event_loop.post { accepted_clients.values.map(&:beat) }
36
+ end
37
+ end
32
38
  end
33
39
  end
34
40
  end
@@ -9,22 +9,10 @@ module Tamashii
9
9
  module Manager
10
10
  # :nodoc:
11
11
  class Server < Tamashii::Server::Base
12
- def initialize
13
- super
14
- setup_heartbeat_timer
15
- end
16
-
17
12
  def call(env)
18
13
  super
19
14
  end
20
15
 
21
- # NOTE: Move into Tamashii::Server maybe better
22
- def setup_heartbeat_timer
23
- @heartbeat_timer = @event_loop.timer(Config.heartbeat_interval) do
24
- @event_loop.post { Client.accepted_clients.values.map(&:beat) }
25
- end
26
- end
27
-
28
16
  def inspect
29
17
  "Tamashii::Manager::Server v#{VERSION}"
30
18
  end
@@ -1,5 +1,5 @@
1
1
  module Tamashii
2
2
  module Manager
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tamashii-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - 蒼時弦也
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-09-20 00:00:00.000000000 Z
13
+ date: 2017-10-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: puma