You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2026/04/25 05:24:31 UTC

(groovy) branch master updated: Trivial refactor: use `await` instead

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e72da4065 Trivial refactor: use `await` instead
0e72da4065 is described below

commit 0e72da4065dcb0e1cdffbbbe4b583c3f8809cbcc
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Apr 25 14:24:19 2026 +0900

    Trivial refactor: use `await` instead
---
 src/test/groovy/groovy/concurrent/FlowPublisherAdapterTest.groovy | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/groovy/concurrent/FlowPublisherAdapterTest.groovy b/src/test/groovy/groovy/concurrent/FlowPublisherAdapterTest.groovy
index c6d05c1cb3..8db776627c 100644
--- a/src/test/groovy/groovy/concurrent/FlowPublisherAdapterTest.groovy
+++ b/src/test/groovy/groovy/concurrent/FlowPublisherAdapterTest.groovy
@@ -84,12 +84,13 @@ final class FlowPublisherAdapterTest {
     void testForAwaitIteratesAllValues() {
         assertScript '''
             import java.util.concurrent.SubmissionPublisher
+            import groovy.concurrent.Awaitable
 
             def publisher = new SubmissionPublisher<Integer>()
             async {
                 // SubmissionPublisher only delivers submitted items to existing subscribers.
                 for (int i = 0; i < 100 && !publisher.hasSubscribers(); i++) {
-                    Thread.sleep(50)
+                    await Awaitable.delay(50)
                 }
 
                 (1..5).each { publisher.submit(it) }
@@ -122,12 +123,13 @@ final class FlowPublisherAdapterTest {
     void testForAwaitPropagatesError() {
         def thrown = shouldFail RuntimeException, '''
             import java.util.concurrent.SubmissionPublisher
+            import groovy.concurrent.Awaitable
 
             def publisher = new SubmissionPublisher<Integer>()
             async {
                 // SubmissionPublisher only delivers submitted items to existing subscribers.
                 for (int i = 0; i < 100 && !publisher.hasSubscribers(); i++) {
-                    Thread.sleep(50)
+                    await Awaitable.delay(50)
                 }
 
                 publisher.submit(1)