Use process context

This commit is contained in:
Neil Alexander 2022-03-03 15:39:39 +00:00
parent e09019f68c
commit 37b93377b5
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -15,7 +15,6 @@
package userapi
import (
"context"
"time"
"github.com/gorilla/mux"
@ -90,7 +89,7 @@ func NewInternalAPI(
var cleanOldNotifs func()
cleanOldNotifs = func() {
logrus.Infof("Cleaning old notifications")
if err := db.DeleteOldNotifications(context.Background()); err != nil {
if err := db.DeleteOldNotifications(base.Context()); err != nil {
logrus.WithError(err).Error("Failed to clean old notifications")
}
time.AfterFunc(time.Hour, cleanOldNotifs)