From c74aa11f76156e7135db811ef9bba98b24cc0bee Mon Sep 17 00:00:00 2001 From: nihiyama <1klyot8qo@gmail.com> Date: Sun, 30 Jan 2022 10:46:07 +0900 Subject: [PATCH] add retuning 'int' with redis publish --- broadcaster/_backends/redis.py | 4 ++-- broadcaster/_base.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/broadcaster/_backends/redis.py b/broadcaster/_backends/redis.py index b545bad..05866e2 100644 --- a/broadcaster/_backends/redis.py +++ b/broadcaster/_backends/redis.py @@ -28,8 +28,8 @@ async def subscribe(self, channel: str) -> None: async def unsubscribe(self, channel: str) -> None: await self._subscriber.unsubscribe([channel]) - async def publish(self, channel: str, message: typing.Any) -> None: - await self._pub_conn.publish(channel, message) + async def publish(self, channel: str, message: typing.Any) -> int: + return await self._pub_conn.publish(channel, message) async def next_published(self) -> Event: message = await self._subscriber.next_published() diff --git a/broadcaster/_base.py b/broadcaster/_base.py index c58cb1d..d8b8a30 100644 --- a/broadcaster/_base.py +++ b/broadcaster/_base.py @@ -75,8 +75,8 @@ async def _listener(self) -> None: for queue in list(self._subscribers.get(event.channel, [])): await queue.put(event) - async def publish(self, channel: str, message: Any) -> None: - await self._backend.publish(channel, message) + async def publish(self, channel: str, message: Any) -> Optional[int]: + return await self._backend.publish(channel, message) @asynccontextmanager async def subscribe(self, channel: str) -> AsyncIterator["Subscriber"]: