tusharmath
tusharmath5mo ago

Run all pending ticks synchronously

Currently it seems like run_event_loop is the only way to run all the pending ops that are scheduled including the ones that are scheduled for the next tick. Is there a way to just call the next tick on the runtime?
1 Reply
Deno AI Helper
Deno AI Helper5mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on your message, it seems like you're looking for a way to manually control the event loop or microtask queue in Deno, which is not a common pattern in Deno's API design. Deno's runtime is built on top of the Tokio event loop, and it abstracts away the manual handling of the event loop for most use cases. The run_event_loop function you mentioned is not part of Deno's stable or unstable APIs, and it's not recommended to try and manually manipulate the event loop as this could lead to unexpected behavior. If you're trying to ensure that all microtasks and asynchronous operations have completed, you would typically use await on Promises or async functions. There is no standard API in Deno to force the event loop to run only the next tick's operations synchronously. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. If you're dealing with a specific problem related to asynchronous operations, it might be helpful to look into using async/await patterns, Promises, or even considering the design of your application to ensure proper handling of asynchronous events.