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

on_properties_changed blocks loop.create_task until a property changes #136

Open
insidewhy opened this issue Oct 26, 2022 · 0 comments
Open

Comments

@insidewhy
Copy link

I need to interact with a keypress handler object and call async methods on an interface so I have something like this:

loop = asyncio.get_event_loop()

def handle_keypress(key: str):
  print("got key", key)

def handle_keypress_helper(key: str) -> None
  loop.create_task(handle_keypress(key))

read_input.start(handle_keypress_helper)

If I add an on_properties_changed handler like so:

properties.on_properties_changed(on_properties_changed)

Then my key logs get blocked until a property changes. So say I press five keys, then after a property changes I finally get the logs of the five key presses.

So it looks like on_properties_changed is blocking other tasks during the wait for a property change and then they only get flushed after changes.

@insidewhy insidewhy changed the title on_properties_changed blocks other tasks until a property changes on_properties_changed blocks loop.create_task until a property changes Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant