From 7c31d07ffe4c77ee6f2065729a09200811d4658c Mon Sep 17 00:00:00 2001 From: Ian Good Date: Sun, 13 Aug 2023 19:25:48 -0400 Subject: [PATCH] Support swim-protocol 0.6.0 --- pymap/cluster/swim.py | 9 ++++----- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pymap/cluster/swim.py b/pymap/cluster/swim.py index cc19b1c6..0e0751d6 100644 --- a/pymap/cluster/swim.py +++ b/pymap/cluster/swim.py @@ -64,14 +64,13 @@ async def _start(self, args: Namespace, stack: AsyncExitStack) -> None: _log.debug('SWIM configuration: %r %r', config.local_name, config.peers) - transport = transport_type(config) members = Members(config) worker = Worker(config, members) + transport = transport_type(config, worker) cluster_metadata.get().listen(self._local_update, members) - stack.enter_context(members.listener.on_notify(self._remote_update)) - await stack.enter_async_context(transport.enter(worker)) - task = asyncio.create_task(worker.run()) - stack.callback(task.cancel) + await stack.enter_async_context(transport) + await stack.enter_async_context( + members.listener.on_notify(self._remote_update)) async def start(self, stack: AsyncExitStack) -> None: args = self.config.args diff --git a/pyproject.toml b/pyproject.toml index 6250f98a..2019ec90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ admin = ['pymap-admin ~= 0.12.0'] macaroon = ['pymacaroons ~= 0.13.0'] redis = ['redis ~= 4.2', 'msgpack ~= 1.0'] sieve = ['sievelib ~= 1.2'] -swim = ['swim-protocol ~= 0.5.0'] +swim = ['swim-protocol ~= 0.6.0'] systemd = ['systemd-python'] optional = ['hiredis', 'passlib ~= 1.7', 'pid ~= 3.0']