Skip to content

fix(lib): support concurrent next calls in asAsync for concur iterables - #85

Open
Bortlesboat wants to merge 1 commit into
TomerAberbach:mainfrom
Bortlesboat:fix-concurrent-next-as-async
Open

Bortlesboat wants to merge 1 commit into
TomerAberbach:mainfrom
Bortlesboat:fix-concurrent-next-as-async

Conversation

@Bortlesboat

Copy link
Copy Markdown

The async iterator returned by asAsync for a concur iterable only tracked a single pending waiter, so calling next() again before the previous call settled overwrote it and the earlier promise never resolved (e.g. Promise.all([it.next(), it.next()]) hangs). This shares the pending promise between waiters and has each next() loop until a result is available, so concurrent calls resolve in order. Added a property test that calls next() once more than the number of values, all at once.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant