go/svc/leasifier: sort returned leases

master
q3k 2019-04-06 01:28:04 +02:00
parent a9a266c08c
commit 208f005830
1 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"io"
"net"
"os"
"sort"
"strings"
"time"
@ -164,6 +165,7 @@ func (s *service) work(ctx context.Context) {
glog.Errorf("Could not parse lease file: %v", err)
return
}
sort.Slice(l, func(i, j int) bool { return string([]byte(l[i].ip)) < string([]byte(l[j].ip)) })
leases = l
glog.Infof("Got %d leases", len(leases))
}