Skip to content

Commit

Permalink
fixed the new timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
barshaul committed Dec 8, 2021
1 parent 50c0ef8 commit c2ebd78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c2ebd78

Please sign in to comment.