async 2.6.5 → 2.7.0

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: e0cfe1b6b08ec351525794bf18b2560f3a27c7b99dea7473da7f84c5b58007a7
4
- data.tar.gz: 82e348d00328befab2e33e27e86c6e9f185ca8dcdce0c15f869ae3d7fc986378
3
+ metadata.gz: 53de22a28c0c092ca81a83cb13c3ffba282d837c3eaab45fac9c8b130e0483a7
4
+ data.tar.gz: 647c8709231ffd1c24d1e6d166978ffe5b7b0ed3da17054dd8c43f131a8b29f5
5
5
  SHA512:
6
- metadata.gz: 065ce5006a47535ce599e337bd985b273a64f4e2c3a314177e80763d8c140117d0cf3f4e20ae95a886f9f861cdc4fb4b9f3129ed1955dc45f11cb4db63b8418c
7
- data.tar.gz: 0ce35238436ea0205fcdde862925ed80932f62875dbcc05b1d25742ee3f2a42c0588709dd2abad7f33245d5f619c46322caa2534eddeffb5840778eada51f53d
6
+ metadata.gz: b38fe4b6304d66e7911f392c15334a0e3fadd4751a593fbcfcc4aa31726d02d7482888f0d038568dee034647cba7453a50916aecb1d40111ee7a3d1d76c555ba
7
+ data.tar.gz: 4b48c52dc39f10835f36e84d25b45ab5b6d89f213c232fd8f791e0c1d318901eb1826a5c57fca8daa95b8ba32f6130e02f022986c40bdfc194aab8506b47a5bb
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- x,C�K���c�5)u��"MR�%ʻ��� 0rT�6ˆ��9h���������ё4k�
2
- Ǣ�Nh�� �"1�A|�IT�D�|�_��:T�+�V����f��e���z]B��k���iJ|�In�}H?�'��O�\�E&���T�U?�m1i
3
- �-�z��R8�Vj
1
+ �o���<�z��"9���5�{k��$���s���.B
2
+ ��q��Q=W c ���tOB�γ����|^|/b�'f;2J`�,q�����w�?�������V��n8}߼���`�Z�ys��bI���Zb�����]W
3
+ SV<߉���AO4+}�Q��d��Ͼ7k���M����*�y��M= ��sh�68_�V��oM'�O��\EPs� �S�����c�$:�+U�mKyr���0_n|7���Ь} ~(��3�.�^A����=SQ���e��[˗b����M�h���:',�L
@@ -165,29 +165,66 @@ module Async
165
165
  ::Resolv.getaddresses(hostname)
166
166
  end
167
167
 
168
+
169
+ if IO.method_defined?(:timeout)
170
+ private def get_timeout(io)
171
+ io.timeout
172
+ end
173
+ else
174
+ private def get_timeout(io)
175
+ nil
176
+ end
177
+ end
178
+
168
179
  # @asynchronous May be non-blocking..
169
180
  def io_wait(io, events, timeout = nil)
170
181
  fiber = Fiber.current
171
182
 
172
183
  if timeout
184
+ # If an explicit timeout is specified, we expect that the user will handle it themselves:
173
185
  timer = @timers.after(timeout) do
174
186
  fiber.transfer
175
187
  end
188
+ elsif timeout = get_timeout(io)
189
+ # Otherwise, if we default to the io's timeout, we raise an exception:
190
+ timer = @timers.after(timeout) do
191
+ fiber.raise(::IO::TimeoutError, "Timeout while waiting for IO to become ready!")
192
+ end
176
193
  end
177
194
 
178
195
  return @selector.io_wait(fiber, io, events)
179
196
  ensure
180
197
  timer&.cancel
181
198
  end
182
-
199
+
183
200
  if ::IO::Event::Support.buffer?
184
201
  def io_read(io, buffer, length, offset = 0)
185
- @selector.io_read(Fiber.current, io, buffer, length, offset)
202
+ fiber = Fiber.current
203
+
204
+ if timeout = get_timeout(io)
205
+ timer = @timers.after(timeout) do
206
+ fiber.raise(::IO::TimeoutError, "execution expired")
207
+ end
208
+ end
209
+
210
+ @selector.io_read(fiber, io, buffer, length, offset)
211
+ ensure
212
+ timer&.cancel
186
213
  end
187
214
 
188
215
  if RUBY_ENGINE != "ruby" || RUBY_VERSION >= "3.3.0"
189
216
  def io_write(io, buffer, length, offset = 0)
190
- @selector.io_write(Fiber.current, io, buffer, length, offset)
217
+ fiber = Fiber.current
218
+
219
+ if timeout = get_timeout(io)
220
+ timer = @timers.after(timeout) do
221
+ fiber.raise(::IO::TimeoutError, "execution expired")
222
+ end
223
+ end
224
+
225
+ @selector.io_write(fiber, io, buffer, length, offset)
226
+ ensure
227
+ timer&.cancel
191
228
  end
192
229
  end
193
230
  end
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2023, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.6.5"
7
+ VERSION = "2.7.0"
8
8
  end
data.tar.gz.sig CHANGED
@@ -1,5 +1,2 @@
1
-
2
- �˹m��Z�I�U��D3BXq��G��ɣM���q�1�.!0'��*䅩
3
- Lj^m �� ������a�E��U����G#;����x�޼"���[w.j�X3����o�Vf)�S��w��9��쩄�W=�4hC��n��X��+(3l�u�i)����?:���kc��q��m;�(zǐ���_���� ��� cXS��
4
- I�OŘ?C�y�8�
5
- 5@\���4�[� ��Sy�X��=GW�|Z4C�����x�m�j/�U�$o�AI�t�5c��ޮ8z�6}=�FR�B�M5y����Q$��W{H�rAZO�R�]l산�P�J�ny��]:X�(?=P[@� �pn�:L���nݠ�����_�µ��
1
+ �3�w��9}����_N|f$�`����3��ބ<��I��qԨ�
2
+ ��ߌ�����K��Xp3hnB7|� C��f����~J�[�~&rә�t��ɔw��G#+fR�>^����I�-a2.�Z��cN[���o!.���h��)QP�54��%Zw���L�s= �S��?Q���z� o
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.5
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -58,7 +58,7 @@ cert_chain:
58
58
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
59
59
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
60
60
  -----END CERTIFICATE-----
61
- date: 2023-10-29 00:00:00.000000000 Z
61
+ date: 2024-01-02 00:00:00.000000000 Z
62
62
  dependencies:
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: console
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  - !ruby/object:Gem::Version
267
267
  version: '0'
268
268
  requirements: []
269
- rubygems_version: 3.4.10
269
+ rubygems_version: 3.4.22
270
270
  signing_key:
271
271
  specification_version: 4
272
272
  summary: A concurrency framework for Ruby.
metadata.gz.sig CHANGED
Binary file