cztop 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3d86b355a30b1827c5f043d9f0702ba1fac41ced1a5d6d0ebb64afe4b6ee4a9
4
- data.tar.gz: 2693a71698843f37da1a4cd6a48a116fed64017794771fbd29bcb00b5c345ebf
3
+ metadata.gz: ecc7b2951190994c49a1fe184641bc8933b0564dce1bdf00a346b491d67f5810
4
+ data.tar.gz: 0d54b8a9bd48d08ca734a5aee4a5317c13aa1a7f2b620fa036dbde8c61b98eb9
5
5
  SHA512:
6
- metadata.gz: aebc2e503f04d592b82c77689976dd5cd7e4364628063af332072bc199f1e24215302accfc3026359bf06ff69b579033a88b3fdfc86cbfc00845a779cce34bfa
7
- data.tar.gz: 235999ed78bbfcf4ae575c9cdd01cdc73d0cb8e937426f0a3542265d046806250312bfd8cb3e167a8879a4961f835f995332753b841c445083cee85a30524efd
6
+ metadata.gz: b9f762a7ed4509bef25d4f995fd8ed7bcbe40ea67b829eda881d3973b5656ba9c72eb485b56916edddd112006e804d21f74eb17d016d50764db1ef35f7de0c2a
7
+ data.tar.gz: d2a876b9478e43c322e10388ac929d8cc97bcf5a9e19d9b4a67b1e042b2830165ff16d7721334c22ebb42172819b7e9397854123d90908ff8eeaffb0e3055565
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.2.2 (1/7/2024)
2
+ -----
3
+ * restore compatibility with Ruby 3.0+
4
+ * fix latency issue
5
+
1
6
  1.2.1 (1/7/2024)
2
7
  -----
3
8
  * fix changelog URI
data/README.md CHANGED
@@ -117,8 +117,6 @@ At least:
117
117
 
118
118
  * Ruby 3.0, 3.1, 3.2, 3.3
119
119
 
120
- Using CZTop with Async will require Ruby 3.2 because of the use of `IO::TimeoutError`, which was introduced in Ruby 3.2.
121
-
122
120
  ## Installation
123
121
 
124
122
  To use this gem, add this line to your application's Gemfile:
data/cztop.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'CZMQ binding based on the generated low-level FFI bindings of CZMQ'
13
13
  spec.homepage = "https://rubygems.org/gems/cztop"
14
14
  spec.license = "ISC"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/paddor/cztop"
@@ -32,8 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "rspec-given", "~> 3.8.0"
33
33
  spec.add_development_dependency "pry"
34
34
  spec.add_development_dependency "yard"
35
-
36
- if RUBY_VERSION >= '3.1'
37
- spec.add_development_dependency "async", ">= 2.0.1"
38
- end
35
+ spec.add_development_dependency "async"
39
36
  end
@@ -52,16 +52,18 @@ module CZTop::HasFFIDelegate
52
52
  # SystemCallError subclass, if errno is known)
53
53
  def raise_zmq_err(msg = CZMQ::FFI::Errors.strerror,
54
54
  errno: CZMQ::FFI::Errors.errno)
55
-
56
55
  case errno
57
- when Errno::EINVAL::Errno then raise ArgumentError, msg, caller
58
- when Errno::EINTR::Errno then raise Interrupt, msg, caller
59
- when Errno::EHOSTUNREACH::Errno then raise SocketError, msg, caller
60
-
61
- # If the errno is known, the corresponding Errno::* exception is
62
- # automatically constructed. Otherwise, it'll be a plain SystemCallError.
63
- # In any case, #errno will return the corresponding errno.
64
- else raise SystemCallError.new(msg, errno), msg, caller
56
+ when Errno::EINVAL::Errno
57
+ fail ArgumentError, msg, caller
58
+ when Errno::EINTR::Errno
59
+ fail Interrupt, msg, caller
60
+ when Errno::EHOSTUNREACH::Errno
61
+ fail SocketError, msg, caller
62
+ else
63
+ # If the errno is known, the corresponding Errno::* exception is
64
+ # automatically constructed. Otherwise, it'll be a plain SystemCallError.
65
+ # In any case, #errno will return the corresponding errno.
66
+ fail SystemCallError.new(msg, errno), msg, caller
65
67
  end
66
68
  end
67
69
 
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Support Ruby < 3.2
4
+ unless defined? IO::TimeoutError
5
+ class IO::TimeoutError < IOError
6
+ end
7
+ end
8
+
3
9
  module CZTop
4
10
  # These are methods that can be used on a {Socket} as well as an {Actor},
5
11
  # but actually just pass through to methods of {Message} (which take
@@ -52,6 +58,7 @@ module CZTop
52
58
  timeout_at = now + timeout
53
59
 
54
60
  while true
61
+ # p wait_readable: self, timeout: timeout
55
62
  @fd_io.wait_readable(timeout)
56
63
  break if readable? # NOTE: ZMQ FD can't be trusted
57
64
  raise ::IO::TimeoutError if now >= timeout_at
@@ -60,8 +67,10 @@ module CZTop
60
67
  sleep JIFFY
61
68
  end
62
69
  else
63
- until readable?
70
+ while true
71
+ # p wait_readable: self
64
72
  @fd_io.wait_readable
73
+ break if readable? # NOTE: ZMQ FD can't be trusted
65
74
 
66
75
  # HACK for edge case: avoid hogging CPU if FD for socket type doesn't block and just insists
67
76
  sleep JIFFY
@@ -85,6 +94,7 @@ module CZTop
85
94
  timeout_at = now + timeout
86
95
 
87
96
  while true
97
+ # p wait_writable: self, timeout: timeout
88
98
  @fd_io.wait_writable(timeout)
89
99
  break if writable? # NOTE: ZMQ FD can't be trusted
90
100
  raise ::IO::TimeoutError if now >= timeout_at
@@ -93,8 +103,10 @@ module CZTop
93
103
  sleep JIFFY
94
104
  end
95
105
  else
96
- until writable?
106
+ while true
107
+ # p wait_writable: self
97
108
  @fd_io.wait_writable
109
+ break if writable? # NOTE: ZMQ FD can't be trusted
98
110
 
99
111
  # HACK for edge case: avoid hogging CPU if FD for socket type doesn't block and just insists
100
112
  sleep JIFFY
data/lib/cztop/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CZTop
4
4
 
5
- VERSION = '1.2.1'
5
+ VERSION = '1.2.2'
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cztop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 2.0.1
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 2.0.1
138
+ version: '0'
139
139
  description: CZMQ binding based on the generated low-level FFI bindings of CZMQ
140
140
  email:
141
141
  - paddor@gmail.com
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
201
  requirements:
202
202
  - - ">="
203
203
  - !ruby/object:Gem::Version
204
- version: 3.2.0
204
+ version: 3.0.0
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - ">="