async 1.20.0 → 1.20.1

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: db5bf4667851a5b5c7f18895a970d61429aaa4a3d09b67f1b27114f60c1b3be0
4
- data.tar.gz: 5e01edfda229d537e214c5addc67460d533eb2096580f2055642f160c2f4c116
3
+ metadata.gz: 54073e0570fc66e2aedec5657883edaf4aa90ed0e93241c9d2210debf8886441
4
+ data.tar.gz: 24377adc700b7631969fd299765427ca06208508857eacd5be33b41a137c76c7
5
5
  SHA512:
6
- metadata.gz: 3353bb22a9f9669db6e417d575c953bb7c4384109459b437de5539c6ff0869957f02720bfbb878a6682678015a7d54ea7e67e2caf4c805d59c5fb57e470185be
7
- data.tar.gz: bb6f76024fc98843c9ed1d08e834b9bfa0230deca26f4aa07b87eb8faf761922bab6a89f080b5dbae77b389b45ec8929bbcc0695cd4515058752b4250bd9b76c
6
+ metadata.gz: e6a0f47087e557cfb5d2c9ed32b6fe5738ae1f756b99f23c1ab98bf8722ce22d63cddb629cab9225a98ea901b20912c04e267ac94f194ab913e5a511912bb187
7
+ data.tar.gz: fae19fc4eaad3c8ae827bdf54b2ecacf793c31890bbc47088bc7c01af704cde8eb6f98a7b273706898137d4ca368bcecb15823f8b5f151344e6bada5b12c9adf
@@ -90,7 +90,10 @@ module Async
90
90
 
91
91
  # @attr fiber [Fiber] The fiber which is being used for the execution of this task.
92
92
  attr :fiber
93
- def_delegators :@fiber, :alive?
93
+
94
+ def alive?
95
+ @fiber&.alive?
96
+ end
94
97
 
95
98
  # @attr status [Symbol] The status of the execution of the fiber, one of `:initialized`, `:running`, `:complete`, `:stopped` or `:failed`.
96
99
  attr :status
@@ -142,7 +145,7 @@ module Async
142
145
 
143
146
  if self.current?
144
147
  raise Stop, "Stopping current fiber!"
145
- elsif @fiber.alive?
148
+ elsif @fiber&.alive?
146
149
  @fiber.resume(Stop.new)
147
150
  end
148
151
  end
@@ -240,6 +243,9 @@ module Async
240
243
 
241
244
  # Finish the current task, and all bound bound IO objects.
242
245
  def finish!
246
+ # Allow the fiber to be recycled.
247
+ @fiber = nil
248
+
243
249
  # Attempt to remove this node from the task tree.
244
250
  consume
245
251
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Async
22
- VERSION = "1.20.0"
22
+ VERSION = "1.20.1"
23
23
  end
@@ -201,8 +201,8 @@ RSpec.describe Async::Task do
201
201
 
202
202
  parent_task.stop
203
203
 
204
- expect(parent_task.fiber).to_not be_alive
205
- expect(child_task.fiber).to_not be_alive
204
+ expect(parent_task).to_not be_alive
205
+ expect(child_task).to_not be_alive
206
206
  end
207
207
 
208
208
  it "should not remove running task" 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.20.0
4
+ version: 1.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2019-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nio4r