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
+9 -1
View File
@@ -30,7 +30,11 @@ type CookieStore struct {
func (c *CookieStore) RunSessionCleaner(sch *scheduler.Scheduler) {
if c.needsCleanup {
sch.SubmitGenerator(&SessionCleanup{rootDir: c.rootDir}, cookiesMaxAge, scheduler.LowPriority)
sch.SubmitGenerator(
&SessionCleanup{rootDir: c.rootDir},
cookiesMaxAge*time.Second,
scheduler.LowPriority,
)
}
}
@@ -122,6 +126,10 @@ type SessionCleanup struct {
done bool
}
func (gen *SessionCleanup) Name() string {
return "SessionCleanupGenerator"
}
func (gen *SessionCleanup) Next() (scheduler.Task, error) {
sessions, err := getExpiredSessions(gen.rootDir)
if err != nil {