diff options
| author | Sam James <sam@gentoo.org> | 2023-04-09 03:28:08 +0100 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2023-04-09 03:28:48 +0100 |
| commit | 316d122abda56fb4f51ad05b21ecec9983aa8f06 (patch) | |
| tree | 5bc8b367e30bb6718afb61efd4c9d23556f1b67c /dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch | |
| parent | a25cd87e656dbc26b01ae4646b92c3060bf6c7c5 (diff) | |
| download | gentoo-316d122abda56fb4f51ad05b21ecec9983aa8f06.tar.gz gentoo-316d122abda56fb4f51ad05b21ecec9983aa8f06.tar.bz2 gentoo-316d122abda56fb4f51ad05b21ecec9983aa8f06.zip | |
dev-ruby/async: add 1.31.0
Bug: https://bugs.gentoo.org/761550
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch')
| -rw-r--r-- | dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch b/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch new file mode 100644 index 000000000000..240fe060e224 --- /dev/null +++ b/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch @@ -0,0 +1,49 @@ +https://github.com/socketry/async/commit/8f590415c08943372e0227f01d3c32e92dbcbed0 +https://github.com/socketry/async/issues/218 + +From 8f590415c08943372e0227f01d3c32e92dbcbed0 Mon Sep 17 00:00:00 2001 +From: Samuel Williams <samuel.williams@oriontransfer.co.nz> +Date: Sun, 12 Mar 2023 20:33:48 +1300 +Subject: [PATCH] Improve robustness of test, fixes #218. + +--- a/spec/async/semaphore_spec.rb ++++ b/spec/async/semaphore_spec.rb +@@ -62,7 +62,7 @@ + 3.times.map do |i| + semaphore.async do |task| + order << i +- task.sleep(0.1) ++ task.yield + order << i + end + end.collect(&:result) +@@ -72,17 +72,22 @@ + + it 'allows tasks to execute concurrently' do + semaphore = Async::Semaphore.new(3) +- order = [] ++ concurrency = 0 ++ latch = Async::Condition.new + + 3.times.map do |i| + semaphore.async do |task| +- order << i +- task.sleep(0.1) +- order << i ++ concurrency += 1 ++ ++ if concurrency == 3 ++ latch.signal ++ else ++ latch.wait ++ end + end +- end.collect(&:result) ++ end.each(&:wait) + +- expect(order).to be == [0, 1, 2, 0, 1, 2] ++ expect(concurrency).to be == 3 + end + end + + |
