Qpid: Use monotonic time for drain_events timeout

This commit is contained in:
Ask Solem 2016-12-07 15:29:23 -08:00
parent 66325920c7
commit 474a4be406
1 changed files with 3 additions and 4 deletions

View File

@ -84,7 +84,6 @@ import select
import socket import socket
import ssl import ssl
import sys import sys
import time
import uuid import uuid
from gettext import gettext as _ from gettext import gettext as _
@ -117,7 +116,7 @@ except ImportError: # pragma: no cover
qpid = None qpid = None
from kombu.five import Empty, items from kombu.five import Empty, items, monotonic
from kombu.log import get_logger from kombu.log import get_logger
from kombu.transport.virtual import Base64, Message from kombu.transport.virtual import Base64, Message
from kombu.transport import base from kombu.transport import base
@ -1680,7 +1679,7 @@ class Transport(base.Transport):
:type timeout: int :type timeout: int
""" """
start_time = time.time() start_time = monotonic()
elapsed_time = -1 elapsed_time = -1
while elapsed_time < timeout: while elapsed_time < timeout:
try: try:
@ -1691,7 +1690,7 @@ class Transport(base.Transport):
raise socket.timeout() raise socket.timeout()
else: else:
connection._callbacks[queue](message) connection._callbacks[queue](message)
elapsed_time = time.time() - start_time elapsed_time = monotonic() - start_time
raise socket.timeout() raise socket.timeout()
def create_channel(self, connection): def create_channel(self, connection):