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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/omq/engine/reconnect.rb +20 -1
- 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: d74a6fe050e6b3a4130110d02b786b96dfe5c56f4ddd7436412440b1767e4341
|
|
4
|
+
data.tar.gz: 94549607bd5378704e6c053f7d49d872c87379acd6cd7c1b960340dad7f9ed70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/omq/engine/reconnect.rb
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