use notification state id instead of notifier id

This commit is contained in:
bergquist 2018-10-02 14:53:39 +02:00
parent 9289cba625
commit 7b781e4c3c
2 changed files with 4 additions and 4 deletions

View File

@ -74,7 +74,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
}
cmd := &m.SetAlertNotificationStateToCompleteCommand{
Id: notifier.GetNotifierId(),
Id: notifierState.state.Id,
Version: notifierState.state.Version,
}
@ -84,7 +84,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
func (n *notificationService) sendNotification(evalContext *EvalContext, notifierState *notifierState) error {
if !evalContext.IsTestRun {
setPendingCmd := &m.SetAlertNotificationStateToPendingCommand{
Id: notifierState.state.NotifierId,
Id: notifierState.state.Id,
Version: notifierState.state.Version,
AlertRuleStateUpdatedVersion: evalContext.Rule.StateChanges,
}
@ -110,7 +110,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
for _, notifierState := range notifierStates {
err := n.sendNotification(evalContext, notifierState)
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)
}
}

View File

@ -238,7 +238,7 @@ func UpdateAlertNotification(cmd *m.UpdateAlertNotificationCommand) 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
var current m.AlertNotificationState
sess.ID(cmd.Id).Get(&current)