Skip to content
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

Geal/clean up dedup on cancel #758

Merged
merged 4 commits into from
Apr 4, 2022
Merged

Geal/clean up dedup on cancel #758

merged 4 commits into from
Apr 4, 2022

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Mar 30, 2022

Fix #754

This takes care of cleaning up the wait map by using a oneshot channel as drop signal. This is a pattern that I used a lot in pulsar-rs to perform async tasks on drop

@Geal Geal requested a review from garypen March 30, 2022 09:00
@netlify
Copy link

netlify bot commented Mar 30, 2022

Deploy Preview for apollo-router-docs ready!

Name Link
🔨 Latest commit 7c861a5
🔍 Latest deploy log https://app.netlify.com/sites/apollo-router-docs/deploys/62470b2e3e81810009ae1418
😎 Deploy Preview https://deploy-preview-758--apollo-router-docs.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 settings.

@Geal
Copy link
Contributor Author

Geal commented Mar 30, 2022

hmm, looks like I created this branch from the wrong one 😅

I'll clean that up. The relevant code is in f261ff9

// when _drop_signal is dropped, either by getting out of the block, returning
// the error from ready_oneshot or by cancellation, the drop_sentinel future will
// return with Err(), then we remove the entry from the wait map
let (_drop_signal, drop_sentinel) = oneshot::channel::<()>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could be a mutex rather than a channel.

@Geal Geal force-pushed the geal/clean-up-dedup-on-cancel branch from f261ff9 to 0b441c2 Compare March 30, 2022 09:49
@github-actions

This comment has been minimized.

Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@garypen garypen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Geal
Copy link
Contributor Author

Geal commented Mar 31, 2022

cache.rs is a bit tricky with the two locks, I'll send it in a separate PR so we can take the time to study it

@Geal
Copy link
Contributor Author

Geal commented Apr 1, 2022

can we agree to merge this one at least?

@Geal Geal merged commit 99c217c into main Apr 4, 2022
@Geal Geal deleted the geal/clean-up-dedup-on-cancel branch April 4, 2022 08:42
@Geal Geal added this to the v0.1.0-preview.3 milestone Apr 8, 2022
@Geal Geal self-assigned this Apr 26, 2022
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.

improved async cancellation handling will require more hashmap management
3 participants