Fix container.Reorder

This commit is contained in:
Joel Elkins 2022-08-13 02:32:31 -05:00
parent 7cd28a38a2
commit 54b9bae673
No known key found for this signature in database
GPG Key ID: 133589DC38921AE2

View File

@ -34,22 +34,16 @@ const (
func Reorder(conts []Container, op operation) {
// null orderings go first for either start or stop, as they are executed asynchronously
norm := func(a, b Container) bool {
if !a.StartOrder.Valid {
return true
}
if !b.StartOrder.Valid {
return false
}
return a.StartOrder.ValueOrZero() < b.StartOrder.ValueOrZero()
}
rev := func(a, b Container) bool {
if !a.StartOrder.Valid {
if a.StartOrder.ValueOrZero() == 0 {
return true
}
if !b.StartOrder.Valid {
if b.StartOrder.ValueOrZero() == 0 {
return false
}
return b.StartOrder.ValueOrZero() > a.StartOrder.ValueOrZero()
return norm(b, a)
}
var sorter func(a, b Container) bool
if op == Start {