The need to wait for a given time is no longer valid in 3.2+

The condition interrupt but is fixed in 3.2 so we can avoid
some of the legacy logic in that version (and eventually at
some point we can just remove that code).

Change-Id: I45a871a212bb06fb69c36405161a9e66601b0f0d
This commit is contained in:
Joshua Harlow 2016-05-11 22:17:41 -07:00
parent 6037b2b544
commit 00bb55edf6

View File

@ -15,6 +15,7 @@
import abc
import collections
import sys
import threading
from oslo_log import log as logging
@ -24,6 +25,16 @@ from oslo_messaging._drivers import common
LOG = logging.getLogger(__name__)
# TODO(harlowja): remove this when we no longer have to support 2.7
if sys.version_info[0:2] < (3, 2):
def wait_condition(cond):
# FIXME(markmc): timeout needed to allow keyboard interrupt
# http://bugs.python.org/issue8844
cond.wait(timeout=1)
else:
def wait_condition(cond):
cond.wait()
@six.add_metaclass(abc.ABCMeta)
class Pool(object):
@ -67,9 +78,7 @@ class Pool(object):
self._current_size += 1
break
# FIXME(markmc): timeout needed to allow keyboard interrupt
# http://bugs.python.org/issue8844
self._cond.wait(timeout=1)
wait_condition(self._cond)
# We've grabbed a slot and dropped the lock, now do the creation
try: