small fixes and dependency updates

This commit is contained in:
ston1th 2023-08-25 02:06:53 +02:00
commit 96405e2521
238 changed files with 3599 additions and 3467 deletions

View file

@ -3,23 +3,24 @@
package fs
import (
"cmp"
"context"
"io"
"slices"
"strconv"
"sync"
"sync/atomic"
"time"
"github.com/go-logr/logr"
"golang.org/x/exp/slices"
)
type queue []*Preload
func (queue) LessReverse(i, j *Preload) bool { return i.Prio > j.Prio }
func (queue) CompReverse(a, b *Preload) int { return cmp.Compare(b.Prio, a.Prio) }
func (q *queue) Sort() {
slices.SortFunc(*q, q.LessReverse)
slices.SortFunc(*q, q.CompReverse)
}
func (q *queue) Add(ph *PreloadHandler, name string, prio int) {
@ -293,10 +294,7 @@ func (ph *PreloadHandler) preloadStatus(ctx context.Context) {
p.stop(false)
p.delay = time.Second * 2
if p.Errc >= 10 {
if p.Prio >= 0 {
p.Prio = 0
}
p.Prio -= 1
p.Prio = -10
ph.schedule()
} else {
p.Errc += 1