Fix sleep function call
Remove time.sleep method reference in class and use time.sleep directly. Change-Id: Ib4c02061b29c0d584d603746a78ab50922f781c3 Closes-Bug: 1375698
This commit is contained in:
parent
bb37895c2f
commit
e66b6150cb
@ -35,7 +35,6 @@ class RetryDecorator(object):
|
||||
:param retries: number of times to try before giving up
|
||||
:raises: exceptionToCheck
|
||||
"""
|
||||
sleep_fn = time.sleep
|
||||
|
||||
def __init__(self, exceptionToCheck,
|
||||
interval=cfg.CONF.ESWITCH.request_timeout / 1000,
|
||||
@ -56,7 +55,7 @@ class RetryDecorator(object):
|
||||
except self.exc:
|
||||
LOG.debug(_("Request timeout - call again after "
|
||||
"%s seconds"), sleep_interval)
|
||||
RetryDecorator.sleep_fn(sleep_interval)
|
||||
time.sleep(sleep_interval)
|
||||
num_of_iter -= 1
|
||||
sleep_interval *= self.backoff_rate
|
||||
|
||||
|
@ -29,8 +29,7 @@ class WrongException(Exception):
|
||||
class TestRetryDecorator(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestRetryDecorator, self).setUp()
|
||||
self.sleep_fn_p = mock.patch.object(comm_utils.RetryDecorator,
|
||||
'sleep_fn')
|
||||
self.sleep_fn_p = mock.patch("time.sleep")
|
||||
self.sleep_fn = self.sleep_fn_p.start()
|
||||
|
||||
def test_no_retry_required(self):
|
||||
|
Loading…
Reference in New Issue
Block a user