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

Inconsistent postponement on exceptions #64

Open
maxfischer2781 opened this issue Oct 25, 2019 · 0 comments
Open

Inconsistent postponement on exceptions #64

maxfischer2781 opened this issue Oct 25, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@maxfischer2781
Copy link
Contributor

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.

@maxfischer2781 maxfischer2781 added the bug Something isn't working label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant