fix: changing default numWorkers, making it customizable and refactoring scheduler (#1563)

Signed-off-by: Lisca Ana-Roberta <ana.kagome@yahoo.com>
This commit is contained in:
Lisca Ana-Roberta
2023-07-04 11:03:29 +03:00
committed by GitHub
parent 7881ce32b2
commit d4f200c2e1
14 changed files with 101 additions and 29 deletions
+1 -1
View File
@@ -1769,7 +1769,7 @@ type taskGenerator struct {
done bool
}
func (gen *taskGenerator) GenerateTask() (scheduler.Task, error) {
func (gen *taskGenerator) Next() (scheduler.Task, error) {
repo, err := gen.imgStore.GetNextRepository(gen.lastRepo)
if err != nil && !errors.Is(err, io.EOF) {
+2 -1
View File
@@ -26,6 +26,7 @@ import (
. "github.com/smartystreets/goconvey/convey"
zerr "zotregistry.io/zot/errors"
"zotregistry.io/zot/pkg/api/config"
"zotregistry.io/zot/pkg/common"
"zotregistry.io/zot/pkg/extensions/monitoring"
"zotregistry.io/zot/pkg/log"
@@ -48,7 +49,7 @@ const (
var errCache = errors.New("new cache error")
func runAndGetScheduler() (*scheduler.Scheduler, context.CancelFunc) {
taskScheduler := scheduler.NewScheduler(log.Logger{})
taskScheduler := scheduler.NewScheduler(config.New(), log.Logger{})
taskScheduler.RateLimit = 50 * time.Millisecond
ctx, cancel := context.WithCancel(context.Background())