driving async ops in deno_core
What's the correct way to run a single tick of the event loop in
deno_core
? I'm using poll_event_loop
, but the result is always pending (i.e. the timers created with core.queueUserTimer
are never resolving). Is there something else I need to poll?
If I use tokio.block_on(run_event_loop)
it works correctly, but I only want to run a single tick.
My code currently looks like this:
Thanks!2 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the code snippet you've provided, there doesn't seem to be any obvious syntax errors or mistakes.
Please note that my advice is not based on the Deno documentation, and I recommend double-checking the accuracy of the advice given. In the context of
deno_core
, it's important to ensure that the event loop is being managed correctly. If poll_event_loop
is always returning Pending
, it might be indicative of the event loop not being driven to completion, or that the futures within the event loop are not being polled correctly.
Since you're looking to run a single tick of the event loop, you might need to ensure that the runtime is set up correctly and that any necessary setup for timers or other async operations is in place before calling poll_event_loop
. It's also possible that additional configuration or steps are required to properly drive the event loop for a single tick, which might not be covered in the documentation.
If you continue to experience issues, I would suggest reaching out to the Deno community or looking into the source code of deno_core
for more insights on how to properly drive the event loop for a single tick.fixed it by yielding to tokio