omq 0.28.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e5b7537e4771c3cf95f34bc0d6e48f5bcd49234234c7a4a2d7053e7dae0ce62
4
- data.tar.gz: 2999ee7d27ae3e9c0b8235106d46aab741d5c17d4aa98ffd798ea91c2baa7082
3
+ metadata.gz: 898a1e74e82a90b8630dd2d2099824c4d0ca13cf7512df6e1942366cd0e95e9c
4
+ data.tar.gz: fc0021fb361f0cdeadeb8dd72337262cc4d69b7cd2908895036a285955a09798
5
5
  SHA512:
6
- metadata.gz: 35164b7ce34f04f267124da8347979b481712d2127ba49ae2fbee180b55c48fa93aaa82955e66a8215204d90b9b5163dbb6b278565da504bb41cefb977888d43
7
- data.tar.gz: c5529115fd854bb87e987feba2767491f3c85bc643e855aae0f1359df889966718613596a4807a6dd4a58c4134e641b89762ebc6d209e362523692ac072f7c35
6
+ metadata.gz: 07412bdf24c11ad76ddaa67f33f89419f6499db00dff8b50b0607a5bbb7d94df862a24a3ea2dc48cc48842efd00e2205169652767bf57eff4cfcabecd02bbbe0
7
+ data.tar.gz: a56a71ffbcac5df842f9f0b5ec68fa3c992ed33bf3e81cc332355a115967d012e36838f94d45800c4bcca4a5653aa26d3b43e9f46d63b66903aa5c5c529dfa0d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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
+
13
+ ## [0.28.4] - 2026-07-30
14
+
15
+ ### Fixed
16
+
17
+ - Exposed `conflate` through the public socket option accessors.
18
+
5
19
  ## [0.28.3] - 2026-07-30
6
20
 
7
21
  ### Added
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
- return @root_task if @root_task
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/socket.rb CHANGED
@@ -55,6 +55,7 @@ module OMQ
55
55
  :write_timeout, :write_timeout=,
56
56
  :router_mandatory, :router_mandatory=,
57
57
  :router_mandatory?,
58
+ :conflate, :conflate=,
58
59
  :reconnect_interval, :reconnect_interval=,
59
60
  :heartbeat_interval, :heartbeat_interval=,
60
61
  :heartbeat_ttl, :heartbeat_ttl=,
data/lib/omq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OMQ
4
- VERSION = "0.28.3"
4
+ VERSION = "0.28.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.3
4
+ version: 0.28.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger