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:
@@ -72,7 +72,8 @@ class Balancer:
|
|||||||
|
|
||||||
def balance(self, jobs):
|
def balance(self, jobs):
|
||||||
if 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]
|
return jobs[0]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user