cable_room 0.1.0 → 0.1.2

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: bc7b6f7f0f2c70e5db315cd4dc11ff01e7b0d8dcd56ba5d54159d2c0f3b6d56e
4
- data.tar.gz: b8a9866e23a63d93cd52c88ce9008d194f2ed3cea2060b0b533c5236235fe244
3
+ metadata.gz: 841a40a6a2460c6be5811f2fe24e6fffc1bb7291446029bf1e62497df24ee507
4
+ data.tar.gz: fff54424d08af52f0a35d23089f7437054b6d2e9a63ae66d620d7678edeadfdf
5
5
  SHA512:
6
- metadata.gz: c13aee8af8dba031b0e7333539bde585f8e898a8afbf87657a0fc0128e21c32580149b866107c976c4742df690f8c838d0e094b63e96d140a1d6fb6731a8d652
7
- data.tar.gz: 2ca7afb01a2bf5b2c0096045f6f486ecf8a744b63017497fcf9dd835d770d1fd99b37d63a8ff8c442e1aacd7ed5e0167725f08077c93a6de3fde13a94805c4bd
6
+ metadata.gz: d44fa0d6f66a5905e20ad96b3df974d9d44e43e9c057a8de6316def16f3d577c8f3270254c27cc5c0e1fc4a3fab0be2307566f55b77ada20a53c04f946c1834b
7
+ data.tar.gz: ac558498e04bf2d82a9048a7ff1cab21324cc14c36fbcf9073311c3d7bc62cd1094e7df2a17b129cdd5e6bdb06e4befbec49bb6e57f310e4323aab4b2217d4e7
data/README.md CHANGED
@@ -1 +1 @@
1
- # RediConn
1
+ # CableRoom
@@ -121,13 +121,16 @@ module CableRoom
121
121
  end
122
122
  end
123
123
 
124
- def post_work(async: false, &blk)
124
+ def post_work(async: false, silent: false, &blk)
125
125
  if async
126
126
  # Async stuff is mostly untracked - we just post it to the worker pool and forget about it
127
127
  worker_pool.executor.post(&blk)
128
128
  else
129
129
  @mutex.synchronize do
130
- raise "Attempt to post work to dead or shutting down room" if @current_state == :dead || @current_state == :shutting_down
130
+ if @current_state == :dead || @current_state == :shutting_down
131
+ raise "Attempt to post work to dead or shutting down room" unless silent
132
+ return
133
+ end
131
134
  @work_queue << blk
132
135
  end
133
136
  schedule_work
@@ -150,7 +153,7 @@ module CableRoom
150
153
  raise "Attempt to start periodic timer on a dead room" if state == :dead || state == :shutting_down
151
154
 
152
155
  connection.server.scheduler.schedule_every(every) do
153
- post_work(async: false) do
156
+ post_work(async: false, silent: true) do
154
157
  instance_exec(&callback)
155
158
  end
156
159
  end
@@ -23,7 +23,7 @@ module CableRoom
23
23
 
24
24
  scheduler.every(BEAT_INTERVAL) do
25
25
  each_room_channel do |chan|
26
- worker_pool.async_invoke(chan, :beat)
26
+ chan.beat
27
27
  end
28
28
  end
29
29
  end
@@ -96,7 +96,7 @@ module CableRoom
96
96
  ActionCable::Server::Worker.connection = pconn
97
97
  end
98
98
 
99
- def async_invoke(receiver, method, *args, connection: receiver, async: nil, &block)
99
+ def async_invoke(receiver, method, *args, connection: receiver, async: nil, silent: false, &block)
100
100
  # Instead of posting directly to the global pool, post to a dedicated queue for the room/"connection".
101
101
  # This makes each rooms so that they can be processed by at-most-one thread at a time, while still
102
102
  # allowing multiple rooms to be processed by the same thread-pool.
@@ -105,7 +105,7 @@ module CableRoom
105
105
 
106
106
  # "connection" here really references the Channel, since "Connections" in this context don't really exist
107
107
 
108
- connection.post_work(async:) do
108
+ connection.post_work(async:, silent:) do
109
109
  invoke(receiver, method, *args, connection: connection, &block)
110
110
  end
111
111
  end
@@ -1,3 +1,3 @@
1
1
  module CableRoom
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.2".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.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp