mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
fix(scheduler): the session cleanup generator is reset too often (#2220)
This causes the "fair" scheduler to run it too often in the detriment of other generators. The intention was to run it every 2 hours but the measurement unit for 7200 was not specified. Add more logs, including showing a generator name, in order to troubleshoot this kind of issues easier in the future. Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
@@ -972,6 +972,10 @@ type DedupeTaskGenerator struct {
|
||||
Log zlog.Logger
|
||||
}
|
||||
|
||||
func (gen *DedupeTaskGenerator) Name() string {
|
||||
return "DedupeTaskGenerator"
|
||||
}
|
||||
|
||||
func (gen *DedupeTaskGenerator) Next() (scheduler.Task, error) {
|
||||
var err error
|
||||
|
||||
@@ -1085,6 +1089,10 @@ type StorageMetricsInitGenerator struct {
|
||||
MaxDelay int
|
||||
}
|
||||
|
||||
func (gen *StorageMetricsInitGenerator) Name() string {
|
||||
return "StorageMetricsInitGenerator"
|
||||
}
|
||||
|
||||
func (gen *StorageMetricsInitGenerator) Next() (scheduler.Task, error) {
|
||||
if gen.lastRepo == "" && gen.nextRun.IsZero() {
|
||||
gen.rand = rand.New(rand.NewSource(time.Now().UTC().UnixNano())) //nolint: gosec
|
||||
|
||||
@@ -800,6 +800,10 @@ func (gen *GCTaskGenerator) getRandomDelay() int {
|
||||
return gen.rand.Intn(maxDelay)
|
||||
}
|
||||
|
||||
func (gen *GCTaskGenerator) Name() string {
|
||||
return "GCTaskGenerator"
|
||||
}
|
||||
|
||||
func (gen *GCTaskGenerator) Next() (scheduler.Task, error) {
|
||||
if gen.lastRepo == "" && gen.nextRun.IsZero() {
|
||||
gen.rand = rand.New(rand.NewSource(time.Now().UTC().UnixNano())) //nolint: gosec
|
||||
|
||||
Reference in New Issue
Block a user