Diff comments:
> diff --git a/src/maasserver/listener.py b/src/maasserver/listener.py
> index 673f4d1..167818a 100644
> --- a/src/maasserver/listener.py
> +++ b/src/maasserver/listener.py
> @@ -536,6 +537,17 @@ class PostgresListenerService(Service):
> # that we don't process them a second time.
> del notifies[:]
>
> + @contextmanager
> + def listen(self, channel, handler):
> + """
> + Helper for processes that register their channels temporarily
> + """
> + self.register(channel, handler)
> + try:
> + yield
> + finally:
> + self.unregister(channel, handler)
> +
nit: this could use ExitStack
(https://docs.python.org/3.10/library/contextlib.html#contextlib.ExitStack)
>
> def notify_action(target: str, action: str, identifier: Any):
> """Send a notification for an action on a target."""
--
https://code.launchpad.net/~igor-brovtsin/maas/+git/maas/+merge/439621
Your team MAAS Committers is subscribed to branch maas:master.
--
Mailing list: https://launchpad.net/~sts-sponsors
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help : https://help.launchpad.net/ListHelp