Skip to content

on_properties_changed blocks loop.create_task until a property changes #136

Description

@insidewhy

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.

Activity

  1. changed the title [-]on_properties_changed blocks other tasks until a property changes[/-] [+]on_properties_changed blocks loop.create_task until a property changes[/+] on Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions