Fail a pending delivery whose target was deleted (closes #293)
check / check (push) Successful in 3m38s
check / check (push) Successful in 3m38s
Restart recovery and the pending sweep skipped a pending delivery whose target was missing from the batch's target map, every minute, for the life of the database. A miss now asks loadTarget: no row fails the delivery terminally with a recorded reason; any other error leaves it pending, since the map is also empty when its query failed; a target found there is used. The failure goes through the ownership-gated function the retrying paths already used, now failMissingTarget. Once it owns the delivery it re-reads the row and fails it only if the status is unchanged, so a delivery sent and settled in between is left alone. Model: opus-5-5
This commit was merged in pull request #329.
This commit is contained in:
@@ -342,6 +342,31 @@ func (e *Engine) ExportRecoverRetryingDeliveries(
|
||||
e.recoverRetryingDeliveries(webhookDB, webhookID)
|
||||
}
|
||||
|
||||
// ExportFailMissingTarget exposes failMissingTarget, so a test can hand
|
||||
// it a delivery as a batch read it earlier.
|
||||
func (e *Engine) ExportFailMissingTarget(
|
||||
webhookDB *gorm.DB,
|
||||
webhookID string,
|
||||
d *database.Delivery,
|
||||
) {
|
||||
e.failMissingTarget(webhookDB, webhookID, d)
|
||||
}
|
||||
|
||||
// ExportSendRecoveredDeliveries exposes sendRecoveredDeliveries, so a
|
||||
// test can hand it a target map that lacks a delivery's target.
|
||||
func (e *Engine) ExportSendRecoveredDeliveries(
|
||||
ctx context.Context,
|
||||
webhookDB *gorm.DB,
|
||||
deliveries []database.Delivery,
|
||||
webhookID string,
|
||||
targetMap map[string]database.Target,
|
||||
settled map[string]struct{},
|
||||
) {
|
||||
e.sendRecoveredDeliveries(
|
||||
ctx, webhookDB, deliveries, webhookID, targetMap, settled,
|
||||
)
|
||||
}
|
||||
|
||||
// ExportDeliveryCh returns the delivery channel.
|
||||
func (e *Engine) ExportDeliveryCh() chan Task {
|
||||
return e.deliveryCh
|
||||
|
||||
Reference in New Issue
Block a user