changeset 639:5e78705333c3

0.6dev: Fixing a possible situation of two slaves claiming the same build. Closes #95.
author osimons
date Wed, 19 Aug 2009 11:48:07 +0000
parents 74237f60f8a9
children 34776258924e
files bitten/queue.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/queue.py
+++ b/bitten/queue.py
@@ -134,15 +134,16 @@
         # Iterate through pending builds by descending revision timestamp, to
         # avoid the first configuration/platform getting all the builds
         platforms = [p.id for p in self.match_slave(name, properties)]
-        build = None
         builds_to_delete = []
+        build_found = False
         for build in Build.select(self.env, status=Build.PENDING, db=db):
             if self.should_delete_build(build, repos):
                 self.log.info('Scheduling build %d for deletion', build.id)
                 builds_to_delete.append(build)
             elif build.platform in platforms:
+                build_found = True
                 break
-        else:
+        if not build_found:
             self.log.debug('No pending builds.')
             build = None
 
Copyright (C) 2012-2017 Edgewall Software