]> source.dussan.org Git - gitea.git/commitdiff
Fix DB session cleanup (#15697)
authorzeripath <art27@cantab.net>
Sun, 2 May 2021 02:51:03 +0000 (03:51 +0100)
committerGitHub <noreply@github.com>
Sun, 2 May 2021 02:51:03 +0000 (22:51 -0400)
The DB session clean up needs to check expiry not created_unix.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
models/session.go

index fe363ee487316afeb8c6fb837c673fe237a355f9..b2e4837bedd1f5a488f6aeda90030b29960109d4 100644 (file)
@@ -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
 }