Make pop on realm work even if the realm isn't present

This is cleanup code and, occasionally, we get a cleanup without the realm having been added, leading to a KeyError
This commit is contained in:
Joseph Schorr 2017-02-21 10:47:11 -05:00
parent 2ef55a5842
commit fd4a31d3c3

View file

@ -132,9 +132,13 @@ class BuilderServer(object):
logger.debug('Unregistering component with realm %s and token %s',
component.builder_realm, component.expected_token)
self._realm_map.pop(component.builder_realm)
self._current_components.remove(component)
self._session_factory.remove(component)
self._realm_map.pop(component.builder_realm, None)
if component in self._current_components:
self._current_components.remove(component)
if component in self._session_factory:
self._session_factory.remove(component)
def _job_heartbeat(self, build_job):
self._queue.extend_processing(build_job.job_item, seconds_from_now=JOB_TIMEOUT_SECONDS,