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

Command interface for crux_time #312

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Command interface for crux_time #312

merged 2 commits into from
Jan 29, 2025

Conversation

charypar
Copy link
Member

As part of this, I've revised how the cancellation works so that idea of IDs doesn't leak into the app.

@charypar charypar requested a review from StuartHarris January 29, 2025 11:57
let (sender, mut receiver) = oneshot::channel();

let builder = RequestBuilder::new(move |ctx| async move {
// We loop so that we can ignore the Err case of the oneshot receiver and still wait for the original request
Copy link
Contributor

@adwhit adwhit Jan 29, 2025

Choose a reason for hiding this comment

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

What are the semantics here? If the sender is dropped, will the select! still block on the receiver (never resolving) or will the receiver immediately resolve to Err(_), causing a busy loop? The docs make it sound like the latter- https://docs.rs/futures/latest/futures/channel/oneshot/struct.Canceled.html

Copy link
Member Author

Choose a reason for hiding this comment

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

From some testing I've done, dropping the Sender does not wake the future, so I think the Err branch of the cancel channel select is actually unreachable 🤔 I think it's because the Receiver is a FusedFuture and slect checks it's termination status.

Might change the code to remove the loop and put unreachable in there

@charypar charypar merged commit 4e1bfd9 into master Jan 29, 2025
9 checks passed
@charypar charypar deleted the viktor/crux_time-command branch January 29, 2025 14:13
@charypar charypar mentioned this pull request Jan 29, 2025
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.

3 participants