Skip to content

Fix Expired Notification Cleanup

Notifications should be removed from the corresponding database table after they expire. There is an existing implementation which claims to do this and we regularly see messages similar to: Purged X expired notifications (typically x=5000) in our logs. However, the expired notifications in the notification index table are never actually removed and the table seems to grow without bounds.

Current behavior

Expired notifications are reported as being removed from the notification index table in the database, but the notification is never actually removed.

Expected behavior

Expired notifications are regularly removed from the notification index table in the database

Relevant classes

  • JsonNotificationIndex
  • NotificationIndexCleanup

Acceptance criteria

Test-Driven Development

Unit test reproducing problem

  • Add expired notification to table
  • Assert expired notification exists
  • Run cleanup process
  • Assert expired notification does not exist

Test should fail prior to implementing the fix, test should pass upon successful implementation.