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

Handling concurrent asyncio.sleeps #15

Open
pgit opened this issue Apr 15, 2021 · 0 comments · May be fixed by #17
Open

Handling concurrent asyncio.sleeps #15

pgit opened this issue Apr 15, 2021 · 0 comments · May be fixed by #17

Comments

@pgit
Copy link

pgit commented Apr 15, 2021

Let there bei 2 tasks A and B, with A repeatedly sleeping for short intervals (e.g. 0.1s) and B sleeping once for a longer interval (5s). So one Execution of B spans multiple executions of A.

So the callback queue looks like this:

  1. A (0.1s)
  2. B (5s)

Now, when fast-forwarding to 10s, A is popped from the queue first. It schedules another A after 0.1s, which ist still way before the first run of B. But before ist is actually executed, B is popped as well! The next sleep(0.1) issued by A should be executed before B.

Is there any way to make this work, I.e. handle a Tasks that might schedule another task? This would better match the topology of a real-time event queue. (This was tested with Python 3.7.3).

This was referenced Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant