Merge "Fix request timeout errors during calls to NSX controller"

This commit is contained in:
Jenkins 2014-02-21 05:24:56 +00:00 committed by Gerrit Code Review
commit fb923df1cc
2 changed files with 5 additions and 2 deletions

View File

@ -21,6 +21,7 @@
from abc import ABCMeta from abc import ABCMeta
from abc import abstractmethod from abc import abstractmethod
import copy import copy
import eventlet
import httplib import httplib
import logging import logging
import time import time
@ -186,7 +187,8 @@ class NvpApiRequest(object):
LOG.info(_("[%(rid)d] Redirecting request to: %(conn)s"), LOG.info(_("[%(rid)d] Redirecting request to: %(conn)s"),
{'rid': self._rid(), {'rid': self._rid(),
'conn': self._request_str(conn, url)}) 'conn': self._request_str(conn, url)})
# yield here, just in case we are not out of the loop yet
eventlet.greenthread.sleep(0)
# If we receive any of these responses, then # If we receive any of these responses, then
# our server did not process our request and may be in an # our server did not process our request and may be in an
# errored state. Raise an exception, which will cause the # errored state. Raise an exception, which will cause the

View File

@ -139,9 +139,10 @@ class NvpApiRequestEventlet(request.NvpApiRequest):
attempt = 0 attempt = 0
response = None response = None
while response is None and attempt <= self._retries: while response is None and attempt <= self._retries:
eventlet.greenthread.sleep(0)
attempt += 1 attempt += 1
req = self.spawn(self._issue_request).wait() req = self._issue_request()
# automatically raises any exceptions returned. # automatically raises any exceptions returned.
if isinstance(req, httplib.HTTPResponse): if isinstance(req, httplib.HTTPResponse):
if attempt <= self._retries and not self._abort: if attempt <= self._retries and not self._abort: