Show a target paused by its circuit breaker (closes #385)
check / check (push) Successful in 3m20s
check / check (push) Successful in 3m20s
While an http or slack target's circuit breaker is open, the target's row on the webhook page says its deliveries are paused until the cooldown ends, then one is sent to test the target. Each of its retrying deliveries shows as waiting in the event log and on the event's page, with the earliest it can be tried next: the later of the cooldown's end and the end of its own backoff, dated when not today in UTC. While the breaker is half-open, the row says deliveries are held while one delivery tests the target, with no time, and deliveries keep their plain status. The engine gains one read, StateAndCooldown(targetID), taking a breaker's state and remaining cooldown under one lock; the handlers reach it through a one-method interface wired like Archives. Model: opus-5-5
This commit is contained in:
@@ -109,6 +109,10 @@ type DeliveryView struct {
|
||||
// the middle of Results. The page must show it, or the
|
||||
// bound would hide history rather than fold it.
|
||||
AttemptsOmitted int
|
||||
|
||||
// Paused is set while the delivery is retrying and its
|
||||
// target's circuit breaker is open, and nil otherwise.
|
||||
Paused *PausedView
|
||||
}
|
||||
|
||||
// eventLogTarget is what the event log needs to know about
|
||||
@@ -1290,7 +1294,7 @@ func (h *Handlers) eventLogViews(
|
||||
}
|
||||
|
||||
for i := range rows {
|
||||
result[i].Deliveries = newDeliveryViews(
|
||||
result[i].Deliveries = h.newDeliveryViews(
|
||||
eventDeliveries[i], targetMap, attempts,
|
||||
)
|
||||
result[i].ResubmitCount = resubmits[rows[i].ID]
|
||||
@@ -1414,8 +1418,9 @@ func (h *Handlers) loadDeliveryResults(
|
||||
|
||||
// newDeliveryViews projects deliveries for rendering,
|
||||
// resolving each one's target to its display-safe view and
|
||||
// each one's attempts through that target's redactor.
|
||||
func newDeliveryViews(
|
||||
// each one's attempts through that target's redactor. A
|
||||
// retrying delivery also reads its target's circuit breaker.
|
||||
func (h *Handlers) newDeliveryViews(
|
||||
deliveries []database.Delivery,
|
||||
targetMap map[string]eventLogTarget,
|
||||
attempts map[string][]deliveryResultRow,
|
||||
@@ -1438,6 +1443,12 @@ func newDeliveryViews(
|
||||
AttemptCount: len(rows),
|
||||
AttemptsOmitted: omitted,
|
||||
}
|
||||
|
||||
if deliveries[i].Status == database.DeliveryStatusRetrying {
|
||||
views[i].Paused = h.deliveryPausedView(
|
||||
deliveries[i].TargetID, rows,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return views
|
||||
|
||||
Reference in New Issue
Block a user