Skip to content

add cancellation support to async iterable iteration #4274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 6, 2024

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Oct 31, 2024

When the abort signal is triggered, any pending .next() calls should return immediately, and the underlying async iterables .return() method should be called

@yaacovCR yaacovCR requested a review from a team as a code owner October 31, 2024 14:20
@yaacovCR yaacovCR added the PR: feature 🚀 requires increase of "minor" version number label Oct 31, 2024
Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit fe08f46
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/6728bc577a7a610009037eaa
😎 Deploy Preview https://deploy-preview-4274--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yaacovCR yaacovCR requested a review from JoviDeCroock October 31, 2024 14:20
Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@yaacovCR yaacovCR marked this pull request as draft October 31, 2024 14:21
@yaacovCR yaacovCR force-pushed the extend branch 2 times, most recently from 5a99914 to cc36653 Compare October 31, 2024 20:46
@yaacovCR yaacovCR marked this pull request as ready for review November 1, 2024 09:13
@yaacovCR
Copy link
Contributor Author

yaacovCR commented Nov 1, 2024

NOTE: will potentially rename PromiseCanceller to something more generic in a later PR.

Something like: AbortSignalListener, and potentially even the methods of the class can be switched to functions which take a shared AbortSignalListener.

@JoviDeCroock
Copy link
Member

ExecutionOrchestrator could be an over-arching term. It essentially listens for a signal and tears down execute

@yaacovCR
Copy link
Contributor Author

yaacovCR commented Nov 4, 2024

This PR has been updated:

  1. to be a little less clever => with cancellableIterable(), we no longer call the underlying iterable's .return() method automatically. This is tricky to get exactly right -- users of the functions would have to know not to call .return() themselves -- and is also not necessary in our case, because as soon as the iterable errors with any error, including an abort error, our code calls .return() already.

  2. to be a little less sloppy => we now call .disconnect() hopefully everywhere required to remove all added event listeners.

@yaacovCR yaacovCR requested a review from JoviDeCroock November 4, 2024 13:05
@yaacovCR yaacovCR merged commit 1d98a6a into graphql:main Nov 6, 2024
21 checks passed
@yaacovCR yaacovCR deleted the extend branch November 6, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature 🚀 requires increase of "minor" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants