bug 14608: Async timeout counter does not get reset across tests

status 14608: resolved fixed
reviewed-by: Chirag Jog (chirag@clogeny.com)

Set the timeout countdown to start from beginning of each pollAsync instead
of setting it once for the entire run.
This commit is contained in:
Prasanna Santhanam 2012-04-04 16:31:17 +05:30
parent bc3311546b
commit b013fb3107
1 changed files with 5 additions and 3 deletions

View File

@ -97,8 +97,9 @@ class cloudConnection(object):
def pollAsyncJob(self, jobId, response):
cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
cmd.jobid = jobId
timeout = self.asyncTimeout
while self.asyncTimeout > 0:
while timeout > 0:
asyncResonse = self.make_request(cmd, response, True)
if asyncResonse.jobstatus == 2:
@ -107,9 +108,10 @@ class cloudConnection(object):
return asyncResonse
time.sleep(5)
self.asyncTimeout = self.asyncTimeout - 5
self.logging.debug("job: %s still processing, will timeout in %ds"%(jobId, timeout))
timeout = timeout - 5
raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout")
raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout %s"%jobId)
def make_request(self, cmd, response = None, raw=False):
commandName = cmd.__class__.__name__.replace("Cmd", "")