@@ -315,7 +315,7 @@ def get_messages(self, count=1, block=True, timeout=0.1):
315
315
it will block forever.
316
316
"""
317
317
messages = []
318
- if timeout :
318
+ if timeout is not None :
319
319
max_time = time .time () + timeout
320
320
321
321
while count > 0 and (timeout is None or timeout > 0 ):
@@ -328,7 +328,7 @@ def get_messages(self, count=1, block=True, timeout=0.1):
328
328
if not block :
329
329
# If we're not blocking, break.
330
330
break
331
- if timeout :
331
+ if timeout is not None :
332
332
# If we're blocking and have a timeout, reduce it to the
333
333
# appropriate value
334
334
timeout = max_time - time .time ()
@@ -610,7 +610,7 @@ def get_messages(self, count=1, block=True, timeout=10):
610
610
self .size .value = count
611
611
self .pause .clear ()
612
612
613
- if timeout :
613
+ if timeout is not None :
614
614
max_time = time .time () + timeout
615
615
616
616
while count > 0 and (timeout is None or timeout > 0 ):
@@ -633,7 +633,8 @@ def get_messages(self, count=1, block=True, timeout=10):
633
633
self .count_since_commit += 1
634
634
self ._auto_commit ()
635
635
count -= 1
636
- timeout = max_time - time .time ()
636
+ if timeout is not None :
637
+ timeout = max_time - time .time ()
637
638
638
639
self .size .value = 0
639
640
self .start .clear ()
0 commit comments