cztop 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/cztop/send_receive_methods.rb +19 -5
- data/lib/cztop/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: ee0da7ba06a375442f26d2838664bef2e2546bc5b99f7515dbfbb560e8755dd8
|
4
|
+
data.tar.gz: 804736cdfa21a4907be8b9f7dbb3109b3a80e83735502906696454b6f10b0822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b058fc7d52d523028246130134af420161b7a352d7b9d7597482204d2211ab3d0ef75ae47056ba75e237c3dde2150f8df42a929250b55202161a6ca638f6999
|
7
|
+
data.tar.gz: 335d9cb39d1bb7a47aa62965145aa692507c1fa42290cec830657dc333f6909c138535f22d7f4ad2d7c40b8bca7d1c334e2a9f553ee0af881f7c9f6686663312
|
data/CHANGES.md
CHANGED
@@ -48,15 +48,29 @@ module CZTop
|
|
48
48
|
|
49
49
|
|
50
50
|
# Because ZMQ sockets are edge-triggered, there's a small chance that we miss an edge (race condition). To avoid
|
51
|
-
# blocking forever, all waiting on the ZMQ FD is done with this timeout.
|
51
|
+
# blocking forever, all waiting on the ZMQ FD is done with this timeout or less.
|
52
|
+
#
|
53
|
+
# The race condition exists between the calls to {#readable?}/{#writable?} and waiting for the ZMQ FD. If the
|
54
|
+
# socke becomes readable/writable during that time, waiting for the FD could block forever without a timeout.
|
55
|
+
#
|
52
56
|
FD_TIMEOUT = 0.5
|
53
57
|
|
54
58
|
|
55
59
|
# @note Only available on Ruby >= 3.2
|
56
60
|
#
|
57
|
-
def wait_for_fd_signal
|
61
|
+
def wait_for_fd_signal(timeout = nil)
|
58
62
|
@fd_io ||= to_io
|
59
|
-
|
63
|
+
|
64
|
+
if timeout
|
65
|
+
if timeout > FD_TIMEOUT
|
66
|
+
timeout = FD_TIMEOUT
|
67
|
+
end
|
68
|
+
else
|
69
|
+
timeout = FD_TIMEOUT
|
70
|
+
end
|
71
|
+
|
72
|
+
# NOTE: always wait for readability on ZMQ FD
|
73
|
+
@fd_io.wait_readable timeout
|
60
74
|
end if IO.method_defined?(:wait_readable)
|
61
75
|
|
62
76
|
|
@@ -80,7 +94,7 @@ module CZTop
|
|
80
94
|
while true
|
81
95
|
# p wait_readable: self, timeout: timeout
|
82
96
|
|
83
|
-
wait_for_fd_signal
|
97
|
+
wait_for_fd_signal timeout
|
84
98
|
break if readable? # NOTE: ZMQ FD can't be trusted
|
85
99
|
raise ::IO::TimeoutError if timeout_at && now >= timeout_at
|
86
100
|
|
@@ -107,7 +121,7 @@ module CZTop
|
|
107
121
|
while true
|
108
122
|
# p wait_writable: self, timeout: timeout
|
109
123
|
|
110
|
-
wait_for_fd_signal
|
124
|
+
wait_for_fd_signal timeout
|
111
125
|
break if writable? # NOTE: ZMQ FD can't be trusted
|
112
126
|
raise ::IO::TimeoutError if timeout_at && now >= timeout_at
|
113
127
|
|
data/lib/cztop/version.rb
CHANGED