The RecordGroup Id is an AUTO_INCREMENT field. These never wrap! Also, while that field is defined as an INT(6), it is a 32 bit integer anyway so we will not run out of ids for a long time. Generally speaking, for integers the display width (6 here) is meaningless as far as the TestBot is concerned.
Also use more descriptive variable names. $a and $b were a bit misleading too since they have special meaning in the context of the sort() function, meaning which they don't have here.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/RecordGroups.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/testbot/lib/WineTestBot/RecordGroups.pm b/testbot/lib/WineTestBot/RecordGroups.pm index fc1c2528..707d0acd 100644 --- a/testbot/lib/WineTestBot/RecordGroups.pm +++ b/testbot/lib/WineTestBot/RecordGroups.pm @@ -95,12 +95,12 @@ sub CreateRecordGroups(;$)
sub CompareRecordGroups($$) { - my ($a, $b) = @_; + my ($RecordGroup1, $RecordGroup2) = @_;
- # The Id will wrap eventually so sort by Timestamp - # and only use the Id to break ties. - return $a->Timestamp <=> $b->Timestamp || - $a->Id <=> $b->Id; + # The Timestamps have a 1 second granularity and may have duplicates. + # So use the Id to break ties. + return $RecordGroup1->Timestamp <=> $RecordGroup2->Timestamp || + $RecordGroup1->Id <=> $RecordGroup2->Id; }
=pod