From c6f80d69f9ac4508f17c05d04de37ae824fa0e21 Mon Sep 17 00:00:00 2001 From: Matthias Veit Date: Wed, 25 Sep 2024 08:55:29 +0200 Subject: [PATCH] [fix] Wait for pub-sub messages to arrive --- fixcloudutils/redis/pub_sub.py | 3 ++- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fixcloudutils/redis/pub_sub.py b/fixcloudutils/redis/pub_sub.py index 1d4df7c..e506559 100644 --- a/fixcloudutils/redis/pub_sub.py +++ b/fixcloudutils/redis/pub_sub.py @@ -64,7 +64,8 @@ def __init__(self, redis: Redis, channel: str, handler: MessageHandler) -> None: async def start(self) -> None: async def read_messages(pubsub: PubSub) -> None: while True: - msg = await pubsub.get_message(ignore_subscribe_messages=True) + # timeout: waiting time for a message to be received in seconds + msg = await pubsub.get_message(ignore_subscribe_messages=True, timeout=30) try: if msg is not None: data = json.loads(msg["data"]) diff --git a/pyproject.toml b/pyproject.toml index c10b309..0a39c27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fixcloudutils" -version = "1.15.0" +version = "1.15.1" authors = [{ name = "Some Engineering Inc." }] description = "Utilities for fixcloud." license = { file = "LICENSE" }