MCPcopy Index your code
hub / github.com/coder/coder / newFailedDispatch

Method newFailedDispatch

coderd/notifications/notifier.go:335–355  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

333
334// revive:disable-next-line:flag-parameter // Not used for control flow, rather just choosing which metric to increment.
335func (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
357func (n *notifier) newInhibitedDispatch(msg database.AcquireNotificationMessagesRow) dispatchResult {
358 return dispatchResult{

Callers 2

processMethod · 0.95
deliverMethod · 0.95

Calls 3

TimeFunction · 0.92
WithLabelValuesMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected