evilsoft / evilsoft/crocks

Async 'race' and 'all' cancellation after first rejection

Open
#519 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
103
PR merge metrics
No merged PRs in 30d

Description

Running the following script in deno exits the job after 5 seconds, suggesting the first Async (the one resolving in 'OK') keeps running even after the second Async has been rejected:

```
import crocks from 'https://cdn.skypack.dev/crocks'
const {Async} = crocks

const test = Async.resolveAfter(5000, 'OK').race(Async.rejectAfter(1000, 'TIMEOUT'))

test.fork(console.log, console.log)
```
A similar behavior happens with `Async.all`: when a computation is rejected, all the remaining keep going.
Is this the intended behavior? I expect all the remaining computations to be cancelled and the cleanup functions to be executed after a single Aync has been rejected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.