added media fixes, search, push updates, pwa, metrics. preparing release 1.0
This commit is contained in:
@@ -65,3 +65,16 @@ func (s *Store) RevokeAllSessions(ctx context.Context, userID int64) error {
|
||||
`, userID)
|
||||
return err
|
||||
}
|
||||
|
||||
// CleanupSessions removes expired sessions and revocations older than a week.
|
||||
func (s *Store) CleanupSessions(ctx context.Context) (int64, error) {
|
||||
tag, err := s.pool.Exec(ctx, `
|
||||
DELETE FROM sessions
|
||||
WHERE expires_at < now()
|
||||
OR (revoked_at IS NOT NULL AND revoked_at < now() - interval '7 days')
|
||||
`)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return tag.RowsAffected(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user