Skip to content

with tokio::spawn, tokio::time::timeout does not time out promptly? #3847

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

You must be logged in to vote

This is due to the following:

const MAX_TASKS_PER_TICK: usize = 61;

The basic runtime will poll up to 61 futures before it checks the timer or IO drivers.

It's meant to simulate a case where a task is a bit greedy with the CPU, but it calls yield_now once every 1msec, which ought to be good enough, right?

Well, it's one to two orders of magnitude more than what I suggest using in my blog post on blocking.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by jorendorff
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