[
https://issues.apache.org/jira/browse/GROOVY-12788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18152811#comment-18152811
]
ASF GitHub Bot commented on GROOVY-12788:
-----------------------------------------
codecov-commenter commented on PR #3380:
URL: https://github.com/apache/groovy/pull/3380#issuecomment-7277743096
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3380?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 75.3000%. Comparing base
([`494d161`](https://app.codecov.io/gh/apache/groovy/commit/494d161bb13d832e65136174312ea6609867d869?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`9989331`](https://app.codecov.io/gh/apache/groovy/commit/9989331e857b46de78fc5602fd4aeab5198788c1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3380?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3380 +/- ##
==================================================
+ Coverage 75.2860% 75.3000% +0.0140%
- Complexity 49967 49978 +11
==================================================
Files 1775 1775
Lines 163660 163660
Branches 32301 32300 -1
==================================================
+ Hits 123213 123236 +23
+ Misses 28947 28936 -11
+ Partials 11500 11488 -12
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3380?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[.../apache/groovy/runtime/async/AwaitCombinators.java](https://app.codecov.io/gh/apache/groovy/pull/3380?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fruntime%2Fasync%2FAwaitCombinators.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9ydW50aW1lL2FzeW5jL0F3YWl0Q29tYmluYXRvcnMuamF2YQ==)
| `97.5000% <100.0000%> (+3.6728%)` | :arrow_up: |
... and [12 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3380/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Awaitable.all() and await(a, b) do not fail fast as documented
> --------------------------------------------------------------
>
> Key: GROOVY-12788
> URL: https://issues.apache.org/jira/browse/GROOVY-12788
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 6.0.0
> Reporter: Stephen Albrecht
> Priority: Major
>
> Environment: Groovy 6.0.0, JDK 25.0.1
> The
> [JavaDoc|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/groovy/concurrent/Awaitable.java#L402-L404]
> for Awaitable.all() states "Like JavaScript's Promise.all(), the combined
> awaitable fails as soon as the first source fails."
> However, Awaitable.all() waits for every source to complete before failing.
> The implementation in
> [AwaitCombinators.allAsync|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/org/apache/groovy/runtime/async/AwaitCombinators.java#L84-L85]
> is built on CompletableFuture.allOf(), whose JavaDoc states "Returns a new
> CompletableFuture that is completed when all of the given CompletableFutures
> complete. If any of the given CompletableFutures complete exceptionally, then
> the returned CompletableFuture also does so". allOf() therefore isn't
> fail-fast.
> await(a, b) is affected too.
> {code:java}
> import groovy.concurrent.Awaitable
> def time = { String label, Closure body ->
> def start = System.currentTimeMillis()
> try {
> body()
> } catch (e) {
> println "$label threw after ${System.currentTimeMillis() - start}ms"
> }
> }
> time('Awaitable.all') {
> await Awaitable.all(
> async { Thread.sleep(3000) },
> async { throw new RuntimeException('fail') }
> )
> }
> time('await(a, b)') {
> await(
> async { Thread.sleep(3000) },
> async { throw new RuntimeException('fail') }
> )
> }
> {code}
> {code:java}
> Awaitable.all threw after 3005ms
> await(a, b) threw after 3004ms{code}
> Expected: both throw after ~0ms (the second source fails immediately)
> Actual: both throw after 3000ms (once the first source completes)
> allAsync() already [hooks a callback onto every source that runs on
> failure|https://github.com/apache/groovy/blob/bc6b3cfd9f8f3397129f8ebbdf85a189d16d7360/src/main/java/org/apache/groovy/runtime/async/AwaitCombinators.java#L79],
> so it can probably just return the failure immediately with
> result.completeExceptionally(asCompletionException(error)) and keep
> CompletableFuture.allOf() for the success case.
> This would match the Promise.all() behavior which doesn't cancel the
> remaining sources.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)