-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description of the bug
The asynchronous Resource.claim operation does not postpone when claiming fails. This violates usim's guarantee to always postpone on an asynchronous operation.
This issue may apply to other operations as well.
How To Reproduce
Performing an impossible claim does not allow other activities to run.
from usim import instant, run, Resources, ResourcesUnavailable
async def fail_postponed():
res = Resources(capacity=1)
try:
async with res.claim(capacity=2):
pass
except ResourcesUnavailable:
print("Postponed?")
async def postponed():
print("Before postponement...")
await instant
print("After postponement...")
run(fail_postponed(), postponed())
Expected behavior
Any asynchronous operation should postpone at least once before raising a non-failure Exception.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working