Skip to content

Commit

Permalink
Fix DB session cleanup (#15697)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath and 6543 committed May 2, 2021
1 parent a926ff9 commit 6ebd833
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 6ebd833

Please sign in to comment.