mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-13 12:46:53 +00:00
Refactor command system to be queue based
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from collections.abc import Coroutine
|
||||
from enum import Enum
|
||||
import inspect
|
||||
import logging
|
||||
@@ -113,7 +114,7 @@ class EventDispatcher:
|
||||
def subscribe(
|
||||
self,
|
||||
event_type: Union[EventType, None],
|
||||
callback: Callable[[Event], Union[None, asyncio.Future]],
|
||||
callback: Callable[[Event], Coroutine[Any, Any, None]],
|
||||
attribute_filters: Optional[Dict[str, Any]] = None,
|
||||
) -> Subscription:
|
||||
"""
|
||||
@@ -226,7 +227,7 @@ class EventDispatcher:
|
||||
"""
|
||||
future = asyncio.Future()
|
||||
|
||||
def event_handler(event: Event):
|
||||
async def event_handler(event: Event):
|
||||
if not future.done():
|
||||
future.set_result(event)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user