cable_room 0.4.0 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a274c3350a931d2c0260aea67d0474b9297de7201bf5dad12fe2caa0177685d
4
- data.tar.gz: 20840a647279a6e5f07a4a6bb7aac528543d9cb82c8bfef4fb637b7274fc0a4f
3
+ metadata.gz: aec4300c2501be5b03552fb3ee2aa096dfeeae41203f85ad1d9715084f209e2e
4
+ data.tar.gz: 13b6d7062eb049b8235948d80fc121defffd571054cbaf64403ca5adda0c77b4
5
5
  SHA512:
6
- metadata.gz: 7ad1d254f3f02a6dffc54aa4c40f4f57968c2364a3fe27633af97b0df76513abd4eeff8064f9ba2ce8e1929a9817edf3cf82d7d04270563596da128b74833f88
7
- data.tar.gz: de1eb655d4f6071f603e0e4fe69ae904bd507c8e3b15108ccd4339838fa1748a244266b406645657bd713b93a4719741045be0b60e50b0ea80ec07ea9e62976f
6
+ metadata.gz: 58db3c0ae21e9844c810c124241911dcf4414ca068b90f72f7fb9bb734ba3a301f59ae6d73efc787d01144b023fcb6b69aa0ffc842f889a5306349dbab1b8b76
7
+ data.tar.gz: b2fd75650ced68cbb4e071e77e9d81e2f2fa61502d8164eda4f9a0bfaa5360471f4ed2ae0a4840be40aa6a4cd9c8ef53759b3198021fa7eb105c7740c22e1294
@@ -27,6 +27,7 @@ module CableRoom
27
27
 
28
28
  # Requests that the Room shut down gracefully, processing any pending messages
29
29
  def shutdown!(reason = "Room requested shutdown")
30
+ logger.info "Shutdown requested: #{reason}"
30
31
  @cable_channel.initiate_shutdown(reason)
31
32
  end
32
33
 
@@ -3,9 +3,6 @@ module CableRoom
3
3
  module PortManagement
4
4
  extend ActiveSupport::Concern
5
5
 
6
- require_relative 'port_policies'
7
- include PortPolicies
8
-
9
6
  PORT_TIMEOUT = 30.seconds
10
7
 
11
8
  class_methods do
@@ -38,6 +35,9 @@ module CableRoom
38
35
  @current_message_origin = previous_mtok
39
36
  end
40
37
  end
38
+
39
+ require_relative 'port_policies'
40
+ include PortPolicies
41
41
  end
42
42
 
43
43
  def initialize(...)
@@ -94,13 +94,13 @@ module CableRoom
94
94
  def handle_received_message(message)
95
95
  case message['type']
96
96
  when 'port_connected'
97
- message_origin = @_port_clients[@current_message_origin] ||= PortClient.new(@current_message_origin)
97
+ mo = @_port_clients[@current_message_origin] ||= PortClient.new(@current_message_origin)
98
98
 
99
- message_origin.touch_activity!
100
- message_origin.tag!(message['tags'])
99
+ mo.touch_activity!
100
+ mo.tag!(message['tags'])
101
101
 
102
102
  if policy_allows?(message['type'].to_sym)
103
- message_origin.merge!(::ActiveJob::Arguments.deserialize(message['extra'])[0])
103
+ mo.merge!(::ActiveJob::Arguments.deserialize(message['extra'])[0])
104
104
 
105
105
  run_callbacks :port_connected do
106
106
  on_port_connected
@@ -16,7 +16,7 @@ module CableRoom
16
16
  state = states[cfg] ||= {}
17
17
  state[:timer] = start_periodic_timer(->{
18
18
  if instance_exec(&cfg[:block])
19
- shutdown!
19
+ shutdown!("Reaped by #{cfg[:key] || 'anonymous'} reaper")
20
20
  else
21
21
  ping_watchdog
22
22
  end
@@ -67,7 +67,7 @@ module CableRoom
67
67
  return if reaper_config.empty?
68
68
 
69
69
  if reaper_config.any? { |cfg| instance_exec(&cfg[:block]) }
70
- shutdown!
70
+ shutdown!("Reaped by manual check")
71
71
  return
72
72
  end
73
73
 
@@ -14,14 +14,14 @@ module CableRoom
14
14
  end
15
15
 
16
16
  included do
17
- set_callback(:port_connected, :before, :_handle_user_setup_during_connection)
18
- set_callback(:port_disconnected, :after, :_handle_user_cleanup_after_disconnection)
17
+ on_port_connected :_handle_user_setup_during_connection
18
+ on_port_disconnected :_handle_user_cleanup_after_disconnection
19
19
 
20
20
  define_callbacks :user_joined, :user_left
21
21
 
22
22
  self::PortClient.class_eval do
23
23
  def user
24
- @metadata[:user]
24
+ @metadata[:as]
25
25
  end
26
26
  end
27
27
 
@@ -1,3 +1,3 @@
1
1
  module CableRoom
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.3".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp