Make deliveries refused while half-open wait a cooldown (closes #306)
check / check (push) Successful in 5m0s
check / check (push) Successful in 5m0s
While the breaker was half-open, Allow refused every delivery but the probe and CooldownRemaining returned zero, so each queued task for the target went straight back onto the retry channel and rewrote its status on every pass until the probe finished. CooldownRemaining now returns the whole cooldown while half-open, so a refused delivery waits that long. A refused delivery already at retrying is not written again, so the retry counter now moves only when a refusal moves a delivery into retrying. Model: opus-5-5
This commit was merged in pull request #330.
This commit is contained in:
@@ -101,6 +101,19 @@ func (e *Engine) ExportDeliverHTTP(
|
||||
e.httpTarget.Deliver(ctx, webhookDB, d, task, e)
|
||||
}
|
||||
|
||||
// ExportDeliverHTTPWithScheduler delivers via the http target, handing
|
||||
// any retry to sched instead of the engine, so a test can see the
|
||||
// delay each retry is given.
|
||||
func (e *Engine) ExportDeliverHTTPWithScheduler(
|
||||
ctx context.Context,
|
||||
webhookDB *gorm.DB,
|
||||
d *database.Delivery,
|
||||
task *Task,
|
||||
sched Scheduler,
|
||||
) {
|
||||
e.httpTarget.Deliver(ctx, webhookDB, d, task, sched)
|
||||
}
|
||||
|
||||
// ExportDeliverDatabase delivers via the database target.
|
||||
func (e *Engine) ExportDeliverDatabase(
|
||||
webhookDB *gorm.DB, d *database.Delivery,
|
||||
@@ -179,6 +192,14 @@ func (e *Engine) ExportGetCircuitBreaker(
|
||||
return e.httpTarget.getCircuitBreaker(targetID)
|
||||
}
|
||||
|
||||
// ExportSetCircuitBreaker makes cb the http target's circuit breaker
|
||||
// for targetID, so a test can use one with a short cooldown.
|
||||
func (e *Engine) ExportSetCircuitBreaker(
|
||||
targetID string, cb *CircuitBreaker,
|
||||
) {
|
||||
e.httpTarget.circuitBreakers.Store(targetID, cb)
|
||||
}
|
||||
|
||||
// ExportParseHTTPConfig exposes parseHTTPConfig.
|
||||
func (e *Engine) ExportParseHTTPConfig(
|
||||
configJSON string,
|
||||
|
||||
Reference in New Issue
Block a user