File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -456,6 +456,9 @@ def warn(...)
456456
457457 # Finish the current task, moving any children to the parent.
458458 def finish!
459+ # Break the cycle:
460+ @fiber &.async_task = nil
461+
459462 # Don't hold references to the fiber or block after the task has finished:
460463 @fiber = nil
461464 @block = nil # If some how we went directly from initialized to finished.
Original file line number Diff line number Diff line change 8585 expect ( was_current ) . to be == true
8686 expect ( task ) . not . to be ( :current? )
8787 end
88+
89+ it "clears async_task on fiber after task finishes" do
90+ fiber = nil
91+
92+ task = reactor . async do |task |
93+ fiber = Fiber . current
94+ end
95+
96+ # After the task completes, the fiber should no longer reference the task:
97+ expect ( fiber . async_task ) . to be_nil
98+ end
8899 end
89100
90101 with "#async" do
You can’t perform that action at this time.
0 commit comments