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

Sleep directive #89

Open
chriso opened this issue Feb 23, 2024 · 1 comment
Open

Sleep directive #89

chriso opened this issue Feb 23, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@chriso
Copy link
Contributor

chriso commented Feb 23, 2024

The local coroutine scheduler (#52) interacts with Dispatch by polling with zero or more calls. Another capability of poll is the ability to delay resumption of the coroutine(s) (using max_wait).

The scheduler could provide a sleep(duration) directive – alongside the existing call and gather directives – that puts a coroutine to sleep for the specified duration.

This could obviously be used to delay work. It could also be used with #88 to implement higher-level concurrency patterns. For example, await any(sleep(0), someOperation()) could be used to submit a fire-and-forget operation without blocking the coroutine, allowing it to continue on with additional work.

@chriso chriso added the enhancement New feature or request label Feb 23, 2024
@Pryz
Copy link
Contributor

Pryz commented Jun 26, 2024

I was looking at sleep and found this issue. Now that we are integrated with asyncio, I'm guessing we should somehow integrate with asyncio.sleep.

However I'm wondering if we should implement that in the Ring side to provide durable sleeps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants