cleanup expired notification urls

This commit is contained in:
Jesse de Wit
2023-11-16 12:37:46 +01:00
parent 6d307179f1
commit 1ef7d8cf76
4 changed files with 61 additions and 2 deletions

View File

@@ -74,3 +74,16 @@ func (s *NotificationsStore) GetRegistrations(
return result, nil
}
func (s *NotificationsStore) RemoveExpired(
ctx context.Context,
before time.Time,
) error {
_, err := s.pool.Exec(
ctx,
`DELETE FROM public.notification_subscriptions
WHERE refreshed_at < $1`,
before.UnixMicro())
return err
}