omq 0.17.2 → 0.17.3

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: f8a35ab8a212a111e78889494ac1eb18f780b6315eb3993eb83d04ae7ebdb222
4
- data.tar.gz: 32727fe82814e3d36843dcbd82d66ecfbd9c26e5c36e7a173bdcf164dd649f75
3
+ metadata.gz: 5e319844ecfe0e7055c069267be40d71be2c5c48cd48aab400f20ec6c04524d2
4
+ data.tar.gz: f8292ad8abac61ff809e684aefbe60cb1e2efde6e6705355414d4fc66d956a45
5
5
  SHA512:
6
- metadata.gz: 1f78b8ff8a907b606ec376a7186a09b77b91317c91f3bdb1ff7ebd600d36d6e6fea4738b72dc4ddd3c611225df4a9c27fbd8418fe73dfcdf7a20985fdee5516b
7
- data.tar.gz: 3811837748c18669dd6dc604c8253cfdb7b0e26a6c9eda3b61a4c711ac441f88b58c283701e6985880aa03d963338b53cc4271c3e456e6499498f9ce21037d85
6
+ metadata.gz: e35dbfe99e7ac18d34d2c2d6725018838e65c6df6bd35032ef206cca4f3f20b8424ad7132bc82e41d0c1d1284aceba5541de9b80b3f1b57adc5f1bb535088bc4
7
+ data.tar.gz: a595d1c56de6ac693c7c3f65ab872f760c0e118d37ebcf59e54527fa7c560415b648541a631cc35ca74d91a89c534305bdfe1443e1b8a8d18c3992f0be3514ec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.3 — 2026-04-10
4
+
5
+ ### Fixed
6
+
7
+ - **Connect timeout in reconnect loop.** Each connect attempt is now
8
+ capped at the reconnect interval (floor 0.5s) via
9
+ `Async::Task#with_timeout`. Fixes a hang on macOS where a non-blocking
10
+ IPv6 `connect(2)` to `::1` via kqueue never delivers `ECONNREFUSED`
11
+ when nothing is listening — the fiber would block indefinitely,
12
+ stalling the entire reconnect loop.
13
+
14
+ ### Changed
15
+
16
+ - **Extracted `Reconnect#retry_loop`.** The reconnect retry loop is now
17
+ a separate private method, keeping `#run` focused on task spawning and
18
+ error handling.
19
+
3
20
  ## 0.17.2 — 2026-04-10
4
21
 
5
22
  ### Fixed
@@ -37,21 +37,8 @@ module OMQ
37
37
  # @return [void]
38
38
  #
39
39
  def run(parent_task, delay: nil)
40
- delay, max_delay = init_delay(delay)
41
-
42
40
  @engine.tasks << parent_task.async(transient: true, annotation: "reconnect #{@endpoint}") do
43
- loop do
44
- break if @engine.closed?
45
- sleep quantized_wait(delay) if delay > 0
46
- break if @engine.closed?
47
- begin
48
- @engine.transport_for(@endpoint).connect(@endpoint, @engine)
49
- break
50
- rescue *CONNECTION_LOST, *CONNECTION_FAILED, Protocol::ZMTP::Error
51
- delay = next_delay(delay, max_delay)
52
- @engine.emit_monitor_event(:connect_retried, endpoint: @endpoint, detail: { interval: delay })
53
- end
54
- end
41
+ retry_loop(delay: delay)
55
42
  rescue Async::Stop
56
43
  rescue => error
57
44
  @engine.signal_fatal_error(error)
@@ -60,6 +47,38 @@ module OMQ
60
47
 
61
48
  private
62
49
 
50
+
51
+ def retry_loop(delay: nil)
52
+ delay, max_delay = init_delay(delay)
53
+
54
+ loop do
55
+ break if @engine.closed?
56
+ sleep quantized_wait(delay) if delay > 0
57
+ break if @engine.closed?
58
+ begin
59
+ Async::Task.current.with_timeout(connect_timeout) do
60
+ @engine.transport_for(@endpoint).connect(@endpoint, @engine)
61
+ end
62
+ break
63
+ rescue *CONNECTION_LOST, *CONNECTION_FAILED, Protocol::ZMTP::Error, Async::TimeoutError
64
+ delay = next_delay(delay, max_delay)
65
+ @engine.emit_monitor_event(:connect_retried, endpoint: @endpoint, detail: { interval: delay })
66
+ end
67
+ end
68
+ end
69
+
70
+
71
+ # Connect timeout: cap each attempt at the reconnect interval so a
72
+ # hung connect(2) (e.g. macOS kqueue + IPv6 ECONNREFUSED not delivered)
73
+ # doesn't block the retry loop. Floor at 0.5s for real-network latency.
74
+ #
75
+ def connect_timeout
76
+ ri = @options.reconnect_interval
77
+ ri = ri.end if ri.is_a?(Range)
78
+ [ri, 0.5].max
79
+ end
80
+
81
+
63
82
  # Wall-clock quantized sleep: wait until the next +delay+-sized
64
83
  # grid tick. Multiple clients reconnecting with the same interval
65
84
  # wake up at the same instant, collapsing staggered retries into
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.17.2"
4
+ VERSION = "0.17.3"
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.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger