solid_cable 3.0.3 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action_cable/subscription_adapter/solid_cable.rb +41 -4
- data/lib/solid_cable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff4e7b967cec58b0387f709a050e30db6a5d0223f070a63d878242877780c49
|
4
|
+
data.tar.gz: b3ff5a3c70b6594075e311b16ab165bce984a0eb41f1c9be2c2a34e23eccc738
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771044684f961dad0116e7769ac429d06ce613d5779809818a81146a585ef4ffeda081533031a7c90767e6e0cd913478b2ffb3117e1d9886bae48d6b9e6c9459
|
7
|
+
data.tar.gz: 18b65de8a357d40af82bbf0d749ca43dcd864fe8e06b074701c97cbdf37eef3e6aa5f36178b51c853612d14688d1d51d99c395ba894171d73f097a18112daeb0
|
@@ -50,16 +50,22 @@ module ActionCable
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def listen
|
53
|
-
|
53
|
+
loop do
|
54
|
+
break unless running?
|
55
|
+
|
54
56
|
with_polling_volume { broadcast_messages }
|
55
57
|
|
56
|
-
|
58
|
+
interruptible_sleep ::SolidCable.polling_interval
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
62
|
def shutdown
|
61
63
|
self.running = false
|
62
|
-
|
64
|
+
wake_up
|
65
|
+
|
66
|
+
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
67
|
+
thread&.join
|
68
|
+
end
|
63
69
|
end
|
64
70
|
|
65
71
|
def add_channel(channel, on_success)
|
@@ -96,7 +102,7 @@ module ActionCable
|
|
96
102
|
end
|
97
103
|
|
98
104
|
def broadcast_messages
|
99
|
-
Rails.application.
|
105
|
+
Rails.application.executor.wrap do
|
100
106
|
::SolidCable::Message.broadcastable(channels, last_id).
|
101
107
|
each do |message|
|
102
108
|
broadcast(message.channel, message.payload)
|
@@ -112,6 +118,37 @@ module ActionCable
|
|
112
118
|
yield
|
113
119
|
end
|
114
120
|
end
|
121
|
+
|
122
|
+
def wake_up
|
123
|
+
interrupt
|
124
|
+
end
|
125
|
+
|
126
|
+
SELF_PIPE_BLOCK_SIZE = 11
|
127
|
+
|
128
|
+
def interrupt
|
129
|
+
self_pipe[:writer].write_nonblock(".")
|
130
|
+
rescue Errno::EAGAIN, Errno::EINTR
|
131
|
+
# Ignore writes that would block and retry
|
132
|
+
# if another signal arrived while writing
|
133
|
+
retry
|
134
|
+
end
|
135
|
+
|
136
|
+
def interruptible_sleep(time)
|
137
|
+
if time > 0 && self_pipe[:reader].wait_readable(time)
|
138
|
+
loop { self_pipe[:reader].read_nonblock(SELF_PIPE_BLOCK_SIZE) }
|
139
|
+
end
|
140
|
+
rescue Errno::EAGAIN, Errno::EINTR
|
141
|
+
end
|
142
|
+
|
143
|
+
# Self-pipe for signal-handling (http://cr.yp.to/docs/selfpipe.html)
|
144
|
+
def self_pipe
|
145
|
+
@self_pipe ||= create_self_pipe
|
146
|
+
end
|
147
|
+
|
148
|
+
def create_self_pipe
|
149
|
+
reader, writer = IO.pipe
|
150
|
+
{ reader: reader, writer: writer }
|
151
|
+
end
|
115
152
|
end
|
116
153
|
end
|
117
154
|
end
|
data/lib/solid_cable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solid_cable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Pezza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|