From 6ebd833780c97da7b065ad9d3b49d70d7dcdbbd4 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 2 May 2021 03:51:03 +0100 Subject: [PATCH] Fix DB session cleanup (#15697) The DB session clean up needs to check expiry not created_unix. Signed-off-by: Andrew Thornton Co-authored-by: 6543 <6543@obermui.de> --- models/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/session.go b/models/session.go index fe363ee48..b2e4837be 100644 --- a/models/session.go +++ b/models/session.go @@ -117,6 +117,6 @@ func CountSessions() (int64, error) { // CleanupSessions cleans up expired sessions func CleanupSessions(maxLifetime int64) error { - _, err := x.Where("created_unix <= ?", timeutil.TimeStampNow().Add(-maxLifetime)).Delete(&Session{}) + _, err := x.Where("expiry <= ?", timeutil.TimeStampNow().Add(-maxLifetime)).Delete(&Session{}) return err }