From c2ebd78ad5f2763b1eac5cf1ef77f224f6c737c7 Mon Sep 17 00:00:00 2001 From: Bar Shaul Date: Tue, 23 Nov 2021 14:57:25 +0200 Subject: [PATCH] fixed the new timeout --- redis/client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redis/client.py b/redis/client.py index a86f1f812f..d7a924f321 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1518,12 +1518,12 @@ def get_message(self, ignore_subscribe_messages=False, timeout=0): """ if not self.subscribed: # Wait for subscription - deadline = time.time() + timeout + start_time = time.time() if self.subscribed_event.wait(timeout) is True: # The connection was subscribed during the timeout frametime. - # The timeout should be adjusted for the time spent waiting - # for subscription - time_spent = deadline - time.time() + # The timeout should be adjusted based on the time spent + # waiting for the subscription + time_spent = time.time() - start_time timeout = timeout - time_spent else: # The connection isn't subscribed to any channels or patterns,