revive:disable-next-line:flag-parameter // Not used for control flow, rather just choosing which metric to increment.
(msg database.AcquireNotificationMessagesRow, err error, retryable bool)
| 333 | |
| 334 | // revive:disable-next-line:flag-parameter // Not used for control flow, rather just choosing which metric to increment. |
| 335 | func (n *notifier) newFailedDispatch(msg database.AcquireNotificationMessagesRow, err error, retryable bool) dispatchResult { |
| 336 | var result string |
| 337 | |
| 338 | // If retryable and not the last attempt, it's a temporary failure. |
| 339 | // #nosec G115 - Safe conversion as MaxSendAttempts is expected to be small enough to fit in int32 |
| 340 | if retryable && msg.AttemptCount < int32(n.cfg.MaxSendAttempts)-1 { |
| 341 | result = ResultTempFail |
| 342 | } else { |
| 343 | result = ResultPermFail |
| 344 | } |
| 345 | |
| 346 | n.metrics.DispatchAttempts.WithLabelValues(string(msg.Method), msg.TemplateID.String(), result).Inc() |
| 347 | |
| 348 | return dispatchResult{ |
| 349 | notifier: n.id, |
| 350 | msg: msg.ID, |
| 351 | ts: dbtime.Time(n.clock.Now().UTC()), |
| 352 | err: err, |
| 353 | retryable: retryable, |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | func (n *notifier) newInhibitedDispatch(msg database.AcquireNotificationMessagesRow) dispatchResult { |
| 358 | return dispatchResult{ |
no test coverage detected