omq 0.28.4 → 0.28.5
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/CHANGELOG.md +8 -0
- data/lib/omq/pub_sub.rb +1 -1
- data/lib/omq/reactor.rb +23 -2
- data/lib/omq/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: 898a1e74e82a90b8630dd2d2099824c4d0ca13cf7512df6e1942366cd0e95e9c
|
|
4
|
+
data.tar.gz: fc0021fb361f0cdeadeb8dd72337262cc4d69b7cd2908895036a285955a09798
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07412bdf24c11ad76ddaa67f33f89419f6499db00dff8b50b0607a5bbb7d94df862a24a3ea2dc48cc48842efd00e2205169652767bf57eff4cfcabecd02bbbe0
|
|
7
|
+
data.tar.gz: a56a71ffbcac5df842f9f0b5ec68fa3c992ed33bf3e81cc332355a115967d012e36838f94d45800c4bcca4a5653aa26d3b43e9f46d63b66903aa5c5c529dfa0d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.28.5] - 2026-07-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Recreated the shared background reactor after `fork`, avoiding inherited
|
|
10
|
+
queue/task state from the parent process.
|
|
11
|
+
- Applied `SUB` constructor subscriptions before connecting endpoints.
|
|
12
|
+
|
|
5
13
|
## [0.28.4] - 2026-07-30
|
|
6
14
|
|
|
7
15
|
### Fixed
|
data/lib/omq/pub_sub.rb
CHANGED
|
@@ -49,8 +49,8 @@ module OMQ
|
|
|
49
49
|
subscribe: nil, on_mute: :block, backend: nil, &block)
|
|
50
50
|
init_engine(:SUB, recv_hwm: recv_hwm, recv_timeout: recv_timeout,
|
|
51
51
|
on_mute: on_mute, backend: backend)
|
|
52
|
-
attach_endpoints(endpoints, default: :connect)
|
|
53
52
|
self.subscribe(subscribe) unless subscribe.nil?
|
|
53
|
+
attach_endpoints(endpoints, default: :connect)
|
|
54
54
|
finalize_init(&block)
|
|
55
55
|
end
|
|
56
56
|
|
data/lib/omq/reactor.rb
CHANGED
|
@@ -18,6 +18,7 @@ module OMQ
|
|
|
18
18
|
THREAD_NAME = 'omq-io'
|
|
19
19
|
|
|
20
20
|
@mutex = Mutex.new
|
|
21
|
+
@pid = nil
|
|
21
22
|
@thread = nil
|
|
22
23
|
@root_task = nil
|
|
23
24
|
@work_queue = nil
|
|
@@ -36,16 +37,20 @@ module OMQ
|
|
|
36
37
|
# @return [Async::Task]
|
|
37
38
|
#
|
|
38
39
|
def root_task
|
|
39
|
-
|
|
40
|
+
pid = Process.pid
|
|
41
|
+
return @root_task if @root_task && @pid == pid
|
|
42
|
+
|
|
43
|
+
reset_after_fork if @pid && @pid != pid
|
|
40
44
|
|
|
41
45
|
@mutex.synchronize do
|
|
42
|
-
return @root_task if @root_task
|
|
46
|
+
return @root_task if @root_task && @pid == pid
|
|
43
47
|
|
|
44
48
|
ready = Thread::Queue.new
|
|
45
49
|
@work_queue = Async::Queue.new
|
|
46
50
|
@thread = Thread.new { run_reactor(ready) }
|
|
47
51
|
@thread.name = THREAD_NAME
|
|
48
52
|
@root_task = ready.pop
|
|
53
|
+
@pid = pid
|
|
49
54
|
|
|
50
55
|
at_exit { stop! }
|
|
51
56
|
end
|
|
@@ -108,6 +113,11 @@ module OMQ
|
|
|
108
113
|
# @return [void]
|
|
109
114
|
#
|
|
110
115
|
def stop!
|
|
116
|
+
if @pid && @pid != Process.pid
|
|
117
|
+
reset_after_fork
|
|
118
|
+
return
|
|
119
|
+
end
|
|
120
|
+
|
|
111
121
|
return unless @thread&.alive?
|
|
112
122
|
|
|
113
123
|
max_linger = @lingers.empty? ? 0 : @lingers.keys.max
|
|
@@ -118,6 +128,7 @@ module OMQ
|
|
|
118
128
|
@thread = nil
|
|
119
129
|
@root_task = nil
|
|
120
130
|
@work_queue = nil
|
|
131
|
+
@pid = nil
|
|
121
132
|
@lingers.clear
|
|
122
133
|
end
|
|
123
134
|
|
|
@@ -125,6 +136,16 @@ module OMQ
|
|
|
125
136
|
private
|
|
126
137
|
|
|
127
138
|
|
|
139
|
+
def reset_after_fork
|
|
140
|
+
@mutex = Mutex.new
|
|
141
|
+
@thread = nil
|
|
142
|
+
@root_task = nil
|
|
143
|
+
@work_queue = nil
|
|
144
|
+
@pid = nil
|
|
145
|
+
@lingers.clear
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
|
|
128
149
|
# Runs the shared Async reactor.
|
|
129
150
|
#
|
|
130
151
|
# Processes work items dispatched via {.run} while engine
|
data/lib/omq/version.rb
CHANGED