Skip to content

Inconsistent postponement on exceptions #64

@maxfischer2781

Description

@maxfischer2781

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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions