From 4a7f4193326161c97b5a49f0810b3b4b835a7933 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Wed, 27 Nov 2024 19:00:43 +0000 Subject: [PATCH] hive-service: Chain on_channel_open hooks where necessary --- libs/service/hive/service/service.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/service/hive/service/service.py b/libs/service/hive/service/service.py index 76efd2f..2565d89 100644 --- a/libs/service/hive/service/service.py +++ b/libs/service/hive/service/service.py @@ -5,7 +5,7 @@ from typing import Callable, Optional from hive.common import ArgumentParser -from hive.common.functools import once +from hive.common.functools import chained, once from hive.messaging import ( Channel, Connection, @@ -46,9 +46,10 @@ def __post_init__(self): if getattr(self.args, "with_restart_monitor", True) and not in_pytest: rsm = RestartMonitor() - if self.on_channel_open: - raise NotImplementedError - self.on_channel_open = once(rsm.report_via_channel) + self.on_channel_open = chained( + once(rsm.report_via_channel), + self.on_channel_open, + ) @classmethod def main(cls, **kwargs):