async 1.9.1 → 1.10.0

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: 82346eddb843773e16f9c2da955116a1418213921a51790050ea72b316a85098
4
- data.tar.gz: 6b848d0c50780fc9a1013708aeff0de49858423f79d23039d6b795f6548705c5
3
+ metadata.gz: fc6f62aa8e36dcfa1864f1b34d6f81b220583b511b1e81843cca29ba57669160
4
+ data.tar.gz: 0fb3bdc83efe1d7ebb06594d7b85c481d8934e1ba0a73a2858a6e1b772ef2971
5
5
  SHA512:
6
- metadata.gz: 4573fa61270cad3f20b436aa322830eb1a08c77533955b58ae7e422b1788aea34db1b829a6c9a4e23faef1cc7a0d8ea40f4a2915e9102dda4ad319d91c3ed3aa
7
- data.tar.gz: 516c2056b418feea8e39cec3513a8fc2710be916f5b1d5450a3110e9ae8207dcdb7f7a1a36688a98d081086abcb8eddde6d1766df1b01e98abb0045b44eb964a
6
+ metadata.gz: 6b9881a10f81214fbea511eb8d4c7fd1d96af8e92dfebb6452604fe4d6ae35dfa667fbace3c600c25ecdbccb6cfdba6dacbc7bba058051a7e7c7d4de4ceb2941
7
+ data.tar.gz: 3db5a1c721168949e2aef7dae62aab8efc48e960124e894c112245a7174ccea0487e47fb1794750c5434ed192e357cbd19b705b9ebd72992a4b03801754e254d
data/.editorconfig CHANGED
@@ -2,4 +2,4 @@ root = true
2
2
 
3
3
  [*]
4
4
  indent_style = tab
5
- indent_size = 4
5
+ indent_size = 4
data/README.md CHANGED
@@ -110,7 +110,7 @@ As tasks run synchronously until they yield back to the reactor, you can guarant
110
110
  This library aims to support and is [tested against][travis] the following Ruby
111
111
  versions:
112
112
 
113
- * Ruby 2.0+
113
+ * Ruby 2.2+
114
114
  * JRuby 9.1.6.0+
115
115
 
116
116
  If something doesn't work on one of these versions, it's a bug.
data/lib/async/reactor.rb CHANGED
@@ -28,7 +28,7 @@ require 'forwardable'
28
28
 
29
29
  module Async
30
30
  # Raised if a timeout occurs on a specific Fiber. Handled gracefully by {Task}.
31
- class TimeoutError < RuntimeError
31
+ class TimeoutError < Exception
32
32
  end
33
33
 
34
34
  # An asynchronous, cooperatively scheduled event reactor.
@@ -230,13 +230,13 @@ module Async
230
230
  # complete.
231
231
  def timeout(duration)
232
232
  backtrace = caller
233
- task = Fiber.current
233
+ fiber = Fiber.current
234
234
 
235
235
  timer = self.after(duration) do
236
- if task.alive?
236
+ if fiber.alive?
237
237
  error = TimeoutError.new("execution expired")
238
238
  error.set_backtrace backtrace
239
- task.resume error
239
+ fiber.resume error
240
240
  end
241
241
  end
242
242
 
data/lib/async/version.rb CHANGED
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Async
22
- VERSION = "1.9.1"
22
+ VERSION = "1.10.0"
23
23
  end
@@ -156,16 +156,20 @@ RSpec.describe Async::Task do
156
156
  state = nil
157
157
 
158
158
  task = reactor.async do |task|
159
- task.timeout(0.01) do
160
- state = :started
161
- task.sleep(10)
162
- state = :finished
163
- end rescue nil
159
+ begin
160
+ task.timeout(0.01) do
161
+ state = :started
162
+ task.sleep(10)
163
+ state = :finished
164
+ end
165
+ rescue Async::TimeoutError
166
+ state = :timeout
167
+ end
164
168
  end
165
169
 
166
170
  reactor.run
167
171
 
168
- expect(state).to be == :started
172
+ expect(state).to be == :timeout
169
173
  end
170
174
 
171
175
  it "won't timeout if execution completes in time" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-07 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nio4r