Skip to content

Commit

Permalink
hive-service: Chain on_channel_open hooks where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
gbenson committed Nov 27, 2024
1 parent f641514 commit 4a7f419
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libs/service/hive/service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 4a7f419

Please sign in to comment.