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:
Andrei Aaron
2024-02-01 19:15:53 +02:00
committed by GitHub
parent ce4924f841
commit 6a83dd47c0
10 changed files with 57 additions and 3 deletions
+8
View File
@@ -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
+4
View File
@@ -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