Merge "Update request expired property docsting"

This commit is contained in:
Jenkins 2014-03-17 08:13:03 +00:00 committed by Gerrit Code Review
commit f1eea7197e
2 changed files with 7 additions and 3 deletions

View File

@ -100,6 +100,11 @@ class WorkerTaskExecutor(executor.TaskExecutorBase):
@staticmethod
def _handle_expired_request(request):
"""Handle expired request.
When request has expired it is removed from the requests cache and
the `Timeout` exception is set as a request result.
"""
LOG.debug("Request '%r' has expired.", request)
request.set_result(misc.Failure.from_exception(
exc.Timeout("Request '%r' has expired" % request)))

View File

@ -82,15 +82,14 @@ class Request(object):
@property
def expired(self):
"""Check if request is expired.
"""Check if request has expired.
When new request is created its state is set to the PENDING, creation
time is stored and timeout is given via constructor arguments.
Request is considered to be expired when it is in the PENDING state
for more then the given timeout (it is not considered to be expired
in any other state). After request is expired - the `Timeout`
exception is raised and task is removed from the requests map.
in any other state).
"""
if self._state == PENDING:
return self._watch.expired()