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 +4 -4
- data/README.md +1 -1
- data/lib/cable_room/channel_base.rb +6 -3
- data/lib/cable_room/channel_tracker.rb +3 -3
- data/lib/cable_room/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 841a40a6a2460c6be5811f2fe24e6fffc1bb7291446029bf1e62497df24ee507
|
|
4
|
+
data.tar.gz: fff54424d08af52f0a35d23089f7437054b6d2e9a63ae66d620d7678edeadfdf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d44fa0d6f66a5905e20ad96b3df974d9d44e43e9c057a8de6316def16f3d577c8f3270254c27cc5c0e1fc4a3fab0be2307566f55b77ada20a53c04f946c1834b
|
|
7
|
+
data.tar.gz: ac558498e04bf2d82a9048a7ff1cab21324cc14c36fbcf9073311c3d7bc62cd1094e7df2a17b129cdd5e6bdb06e4befbec49bb6e57f310e4323aab4b2217d4e7
|
data/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
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
|
data/lib/cable_room/version.rb
CHANGED