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"]: