mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user