[Tools] testbot: CompareTaskStatus() is not really needed. Remove it.

Francois Gouget <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <E1e72cj-00012Y-9a@amboise>
The scheduler only cares about queued Tasks so there is no need to
compare their Status fields. So the comparison code can easily be
inlined like for Steps.

Signed-off-by: Francois Gouget <[email protected]>
---
 testbot/lib/WineTestBot/Jobs.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index b7b2a0a3..f6c19595 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -403,11 +403,6 @@ sub CompareJobPriority
   return $a->Priority <=> $b->Priority || $a->Id <=> $b->Id;
 }
 
-sub CompareTaskStatus
-{
-  return $b->Status cmp $a->Status || $a->No <=> $b->No;
-}
-
 sub min(@)
 {
   my $m = shift @_;
@@ -827,7 +822,7 @@ sub ScheduleOnHost($$$)
       my $PrepareNextStep;
       my $Tasks = $Step->Tasks;
       $Tasks->AddFilter("Status", ["queued"]);
-      my @SortedTasks = sort CompareTaskStatus @{$Tasks->GetItems()};
+      my @SortedTasks = sort { $a->No <=> $b->No } @{$Tasks->GetItems()};
       foreach my $Task (@SortedTasks)
       {
         my $VM = $Task->VM;
@@ -887,7 +882,7 @@ sub ScheduleOnHost($$$)
         my $Step = $SortedSteps[1];
         $Tasks = $Step->Tasks;
         $Tasks->AddFilter("Status", ["queued"]);
-        @SortedTasks = sort CompareTaskStatus @{$Tasks->GetItems()};
+        @SortedTasks = sort { $a->No <=> $b->No } @{$Tasks->GetItems()};
         foreach my $Task (@SortedTasks)
         {
           my $VMKey = $Task->VM->GetKey();
-- 
2.14.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.