Skip to content

Timeout for blocking_send #5421

Answered by Darksonn
prkadalbcisco asked this question in Q&A
Discussion options

You must be logged in to vote

The blocking_send method will immediately return an error if the receiver is destroyed.

You can get a timeout by doing this:

handle.block_on(tokio::time::timeout(duration, sender.send(msg)));

where handle is a tokio::runtime::Handle you got from your runtime.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@prkadalbcisco
Comment options

Answer selected by prkadalbcisco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants