[v9.4.x] Alerting: Use background context for maintenance function (#64066)
Alerting: Use background context for maintenance function (#64065)
(cherry picked from commit e760f22402)
# Conflicts:
# pkg/services/ngalert/notifier/alertmanager.go
This commit is contained in:
committed by
Kevin Minehart
parent
2386d78193
commit
285824f717
@@ -102,7 +102,8 @@ func newAlertmanager(ctx context.Context, orgID int64, cfg *setting.Cfg, store A
|
||||
retention: retentionNotificationsAndSilences,
|
||||
maintenanceFrequency: silenceMaintenanceInterval,
|
||||
maintenanceFunc: func(state alerting.State) (int64, error) {
|
||||
return fileStore.Persist(ctx, silencesFilename, state)
|
||||
// Detached context here is to make sure that when the service is shut down the persist operation is executed.
|
||||
return fileStore.Persist(context.Background(), silencesFilename, state)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -111,7 +112,8 @@ func newAlertmanager(ctx context.Context, orgID int64, cfg *setting.Cfg, store A
|
||||
retention: retentionNotificationsAndSilences,
|
||||
maintenanceFrequency: notificationLogMaintenanceInterval,
|
||||
maintenanceFunc: func(state alerting.State) (int64, error) {
|
||||
return fileStore.Persist(ctx, notificationLogFilename, state)
|
||||
// Detached context here is to make sure that when the service is shut down the persist operation is executed.
|
||||
return fileStore.Persist(context.Background(), notificationLogFilename, state)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user