Commit 7b781e4c by bergquist

use notification state id instead of notifier id

parent 9289cba6
...@@ -74,7 +74,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no ...@@ -74,7 +74,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
} }
cmd := &m.SetAlertNotificationStateToCompleteCommand{ cmd := &m.SetAlertNotificationStateToCompleteCommand{
Id: notifier.GetNotifierId(), Id: notifierState.state.Id,
Version: notifierState.state.Version, Version: notifierState.state.Version,
} }
...@@ -84,7 +84,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no ...@@ -84,7 +84,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
func (n *notificationService) sendNotification(evalContext *EvalContext, notifierState *notifierState) error { func (n *notificationService) sendNotification(evalContext *EvalContext, notifierState *notifierState) error {
if !evalContext.IsTestRun { if !evalContext.IsTestRun {
setPendingCmd := &m.SetAlertNotificationStateToPendingCommand{ setPendingCmd := &m.SetAlertNotificationStateToPendingCommand{
Id: notifierState.state.NotifierId, Id: notifierState.state.Id,
Version: notifierState.state.Version, Version: notifierState.state.Version,
AlertRuleStateUpdatedVersion: evalContext.Rule.StateChanges, AlertRuleStateUpdatedVersion: evalContext.Rule.StateChanges,
} }
...@@ -110,7 +110,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi ...@@ -110,7 +110,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
for _, notifierState := range notifierStates { for _, notifierState := range notifierStates {
err := n.sendNotification(evalContext, notifierState) err := n.sendNotification(evalContext, notifierState)
if err != nil { if err != nil {
n.log.Error("failed to send notification", "id", notifierState.notifier.GetNotifierId()) n.log.Error("failed to send notification", "id", notifierState.notifier.GetNotifierId(), "error", err)
} }
} }
......
...@@ -238,7 +238,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error { ...@@ -238,7 +238,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) error {
} }
func SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *m.SetAlertNotificationStateToCompleteCommand) error { func SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *m.SetAlertNotificationStateToCompleteCommand) error {
return withDbSession(ctx, func(sess *DBSession) error { return inTransactionCtx(ctx, func(sess *DBSession) error {
version := cmd.Version version := cmd.Version
var current m.AlertNotificationState var current m.AlertNotificationState
sess.ID(cmd.Id).Get(&current) sess.ID(cmd.Id).Get(&current)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment