Skip to content

Aborting an async sleep on transition #513

Open
@amitoren777

Description

@amitoren777

I apologize for posting a question here, but I could not post on Stack-Overflow

I'm implementing an async state machine using python-statemachine, and on entry to a state "A" I'm initiating a timer, by calling asyncio.sleep().
The exit from this state can happen in two ways:

  1. The sleep expires and a transition is invoked to move the state machine to state "B"
  2. An event arrived, where the sleep has to be aborted, and the machine has to move to state "C"

Is there an example of how to accomplish this ?, I'm unclear if under the RTC execution model, its possible to prematurely exit a state.

Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions