Skip to content

Commit 75f5c1b

Browse files
authored
Merge pull request #15 from XenonMolecule/fix-update-handlers
Enabled Custom Update Handlers
2 parents 81ed62f + a8a9918 commit 75f5c1b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gum/gum.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(
121121
self._loop_task: asyncio.Task | None = None
122122
self._batch_task: asyncio.Task | None = None
123123
self._batch_processing_lock = asyncio.Lock()
124-
self.update_handlers: list[Callable[[Observer, Update], None]] = []
124+
self.update_handlers: list[Callable[[Observer, Update], None]] = [self._default_handler]
125125

126126
def start_update_loop(self):
127127
"""Start the asynchronous update loop for processing observer updates."""
@@ -210,7 +210,8 @@ async def _update_loop(self):
210210
upd: Update = fut.result()
211211
obs = gets[fut]
212212

213-
asyncio.create_task(self._default_handler(obs, upd))
213+
for handler in self.update_handlers:
214+
asyncio.create_task(handler(obs, upd))
214215

215216
async def _batch_processing_loop(self):
216217
"""Process batched observations when minimum batch size is reached."""

0 commit comments

Comments
 (0)