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

Fix panic when failing to load RRD size #4872

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

emilk
Copy link
Member

@emilk emilk commented Jan 19, 2024

What

poll-promise has a gotcha: if you drop the Sender without sending a result,, the Promise will panic when polled.

I opened an issue about this: EmbarkStudios/poll-promise#25

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@emilk emilk added the exclude from changelog PRs with this won't show up in CHANGELOG.md label Jan 19, 2024
@@ -158,6 +158,7 @@ fn load_file_size(egui_ctx: &egui::Context, url: String) -> Promise<Option<u64>>
response.status,
response.status_text
);
sender.send(None);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sender.send(None);
// TODO(EmbarkStudios/poll-promise#25): if you drop the `Sender` without sending
// a result, the `Promise` will panic when polled.
// See <https://github.com/EmbarkStudios/poll-promise/issues/25>.
sender.send(None);

Copy link
Member Author

@emilk emilk Jan 19, 2024

Choose a reason for hiding this comment

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

This is a not a TODO - we should always send something, otherwise the promise has nothing to resolve to.
That is: this PR fixes a real bug; the linked poll-promise issue is about what that bug should cause.

@emilk emilk merged commit 803cbaf into main Jan 19, 2024
70 of 80 checks passed
@emilk emilk deleted the emilk/fix-promise-crash branch January 19, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants