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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 067415efb96bcaedba27441396d229af7f7b209aba014558c937260f8522df39
4
- data.tar.gz: 8c857a8dbde6795684091f20ce432362de8159d08f543e02a3181fdc8a9481e7
3
+ metadata.gz: 5ff4e7b967cec58b0387f709a050e30db6a5d0223f070a63d878242877780c49
4
+ data.tar.gz: b3ff5a3c70b6594075e311b16ab165bce984a0eb41f1c9be2c2a34e23eccc738
5
5
  SHA512:
6
- metadata.gz: fdd5f44f173470ee796c86b613f81c6e3148a0a7fb4cef946ad296591e1e90247d814dbf76f4e8cf6587d99d36b219e173c136993e8e212cfa2b1a0cfba753f5
7
- data.tar.gz: e9942e0f6c1f9076fb8e7d18050fadb185d6508b2aa889f3c6470a94c93a40c1d082c4ec8445ef83c8e501122a2684abe9299ccf89c926a7ca3181e337fc884e
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
- while running?
53
+ loop do
54
+ break unless running?
55
+
54
56
  with_polling_volume { broadcast_messages }
55
57
 
56
- sleep ::SolidCable.polling_interval
58
+ interruptible_sleep ::SolidCable.polling_interval
57
59
  end
58
60
  end
59
61
 
60
62
  def shutdown
61
63
  self.running = false
62
- Thread.pass while thread.alive?
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.reloader.wrap do
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidCable
4
- VERSION = "3.0.3"
4
+ VERSION = "3.0.5"
5
5
  end
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.3
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-05 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord