Protect against builds dict changing while we iterate

As we check for lost builds, the builds dict can change which throws
an exception.

Change-Id: I63d042d6b64fe8fb1a755da067df420d52c9eea5
This commit is contained in:
Monty Taylor 2017-09-29 17:16:21 -05:00
parent b58820536f
commit 6150ebc49d
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 3 additions and 1 deletions

View File

@ -445,7 +445,9 @@ class ExecutorClient(object):
def lookForLostBuilds(self):
self.log.debug("Looking for lost builds")
for build in self.builds.values():
# Construct a list from the values iterator to protect from it changing
# out from underneath us.
for build in list(self.builds.values()):
if build.result:
# The build has finished, it will be removed
continue