omq 0.17.0 → 0.17.1

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: ec5d4d1943efe37da6ad5493f80591b9578467e0c470fd4e2a577968580609cd
4
- data.tar.gz: 8476b90cc637629874c94388cd91ae7a6f3ce3aaac410af1aa77c3fbd6470412
3
+ metadata.gz: d74a6fe050e6b3a4130110d02b786b96dfe5c56f4ddd7436412440b1767e4341
4
+ data.tar.gz: 94549607bd5378704e6c053f7d49d872c87379acd6cd7c1b960340dad7f9ed70
5
5
  SHA512:
6
- metadata.gz: 67b62142c8786b9594efdf5f62f0aef8b5329498a04faafec760305cb73d3de354b6f4dd7f5db3e416f4e69e683b1c60ad7920a879fb72c7942d602af2088715
7
- data.tar.gz: 2731913ad5262a1d0038af1887b3c2bb167df719b650dd99d3d59812573180adb0e528eeaafba021823f12d7e8a38dbad92b8df07a9d6bac98a4534b71ae3cfc
6
+ metadata.gz: 8c405863b11243bdc0eee221c7183fa4052748e3c12cc204b57c577dfe98e86541b196be4cbb07ac9f024a35dea78c7a765f0e37109d12e5a5898fc50b521039
7
+ data.tar.gz: cf39178da5ec5250b18822e7de437b910679985e01c96c61e4d50389fdf3318403d1ccc2024516940a13c13b44ad0fe8adda83770cfcb2da678f486c6e1f4a23
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.1 — 2026-04-10
4
+
5
+ ### Changed
6
+
7
+ - **Reconnect sleeps are wall-clock quantized.** `Engine::Reconnect`
8
+ now sleeps until the next `delay`-sized grid tick instead of `delay`
9
+ from now (same math as `Async::Loop.quantized`). Multiple clients
10
+ reconnecting with the same interval wake up at the same instant,
11
+ collapsing staggered retries into aligned waves — easier to reason
12
+ about for observability and cache-warmup, and a server coming back
13
+ up sees one batch of accepts instead of a smear. Wall-clock (not
14
+ monotonic) on purpose: the grid has to line up across processes.
15
+ Anti-jitter by design. Exponential backoff still works: each
16
+ iteration quantizes to its own (growing) interval's grid, and
17
+ clients at the same backoff stage still align with each other.
18
+
3
19
  ## 0.17.0 — 2026-04-10
4
20
 
5
21
  ### Changed
@@ -42,7 +42,7 @@ module OMQ
42
42
  @engine.tasks << parent_task.async(transient: true, annotation: "reconnect #{@endpoint}") do
43
43
  loop do
44
44
  break if @engine.closed?
45
- sleep delay if delay > 0
45
+ sleep quantized_wait(delay) if delay > 0
46
46
  break if @engine.closed?
47
47
  begin
48
48
  @engine.transport_for(@endpoint).connect(@endpoint, @engine)
@@ -60,6 +60,25 @@ module OMQ
60
60
 
61
61
  private
62
62
 
63
+ # Wall-clock quantized sleep: wait until the next +delay+-sized
64
+ # grid tick. Multiple clients reconnecting with the same interval
65
+ # wake up at the same instant, collapsing staggered retries into
66
+ # aligned waves. Same math as +Async::Loop.quantized+.
67
+ #
68
+ # Wall-clock (not monotonic) on purpose: the grid has to line up
69
+ # across processes, and monotonic clocks don't share an origin.
70
+ # Anti-jitter by design — if you want spread, don't call this.
71
+ #
72
+ # @param delay [Numeric] grid interval in seconds
73
+ # @param now [Float] wall-clock time in seconds (injectable for tests)
74
+ # @return [Float] seconds to sleep, always in (0, delay]
75
+ #
76
+ def quantized_wait(delay, now = Time.now.to_f)
77
+ wait = delay - (now % delay)
78
+ wait.positive? ? wait : delay
79
+ end
80
+
81
+
63
82
  def init_delay(delay)
64
83
  ri = @options.reconnect_interval
65
84
  if ri.is_a?(Range)
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.0"
4
+ VERSION = "0.17.1"
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.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger