netrender balancing fix (accessing the list as it is being sorted is not ok)

Caused balancing to error when there was only one job (and more generally, to have a slightly wrong result)
This commit is contained in:
Martin Poirier 2009-12-13 22:24:30 +00:00
parent 6b207579c8
commit 0efa09a676

@ -72,7 +72,8 @@ class Balancer:
def balance(self, jobs):
if jobs:
jobs.sort(key=self.sortKey)
# use inline copy to make sure the list is still accessible while sorting
jobs[:] = sorted(jobs, key=self.sortKey)
return jobs[0]
else:
return None