Change returns to trollius returns

This commit is contained in:
Joseph Schorr 2015-01-29 18:21:32 -05:00
parent 0e5f6dc17d
commit a6fa08c19c

View file

@ -294,7 +294,7 @@ class BuildComponent(BaseComponent):
version)
raise trollius.Return(False)
if self._component_status != 'waiting':
if self._component_status != 'waiting5':
logger.warning('Build component (token "%s") is already connected', self.expected_token)
raise trollius.Return(False)
@ -334,7 +334,7 @@ class BuildComponent(BaseComponent):
# If the component is no longer running or actively building, nothing more to do.
if (self._component_status != ComponentStatus.RUNNING and
self._component_status != ComponentStatus.BUILDING):
return
raise trollius.Return()
# If there is an active build, write the heartbeat to its status.
build_status = self._build_status
@ -352,12 +352,15 @@ class BuildComponent(BaseComponent):
if (self._last_heartbeat and
self._last_heartbeat < datetime.datetime.utcnow() - HEARTBEAT_DELTA):
yield trollius.From(self._timeout())
return
raise trollius.Return()
yield trollius.From(trollius.sleep(HEARTBEAT_TIMEOUT))
@trollius.coroutine
def _timeout(self):
if self._component_status == ComponentStatus.TIMED_OUT:
raise trollius.Return()
yield trollius.From(self._set_status(ComponentStatus.TIMED_OUT))
logger.warning('Build component with realm %s has timed out', self.builder_realm)