Skip to content

Commit ec88c53

Browse files
Add regression test for cancelling pool gardener.
1 parent 62d6bb6 commit ec88c53

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎test/async/pool/controller.rb‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,4 +486,19 @@ def failures(repeats: 500, time_scale: 0.001, &block)
486486
pool.close
487487
end
488488
end
489+
490+
with "cancellation while waiting" do
491+
it "cancels the gardener when closing the pool" do
492+
# Regression test for https://bugs.ruby-lang.org/issues/20907.
493+
# Allocating a resource starts the gardener, which then parks in `#wait`:
494+
resource = pool.acquire
495+
gardener = pool.instance_variable_get(:@gardener)
496+
pool.release(resource)
497+
498+
# This stops the gardener while it is waiting:
499+
pool.close
500+
501+
expect(gardener.wait).to be_nil
502+
end
503+
end
489504
end

0 commit comments

Comments
 (0)