You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the example code from the README, the following script leads into a deadlock and never ends:
async def coro(id, timeout):
print(f"Start coro #{id} with timeout {timeout}", flush=True)
await asyncio.sleep(timeout)
print(f"End coro #{id} with timeout {timeout}", flush=True)
async def main():
scheduler = await aiojobs.create_scheduler(limit=1, pending_limit=1)
for i in range(3):
# spawn jobs
await scheduler.spawn(coro(i, 2))
print(f"Coro #{i} scheduled.", flush=True)
print("All coro are scheduled.", flush=True)
await asyncio.sleep(10.0)
# not all scheduled jobs are finished at the moment
# gracefully close spawned jobs
print("Waiting for pending jobs.", flush=True)
await scheduler.close()
asyncio.get_event_loop().run_until_complete(main())
Running the script gives:
Coro #0 scheduled.
Coro #1 scheduled.
Start coro #0 with timeout 2
End coro #0 with timeout 2
=> stuck here, Coro #3 is never scheduled, Coro #2 is scheduled but not run.
Testing env:
Python 3.6.12 + aiojobs 0.3.0
Python 3.812 + aiojobs 1.0.0
The text was updated successfully, but these errors were encountered:
Based on the example code from the README, the following script leads into a deadlock and never ends:
Running the script gives:
=> stuck here, Coro #3 is never scheduled, Coro #2 is scheduled but not run.
Testing env:
The text was updated successfully, but these errors were encountered: