Skip to content
Arbinel

Webhook delivery

Arbinel sends the events of one webhook one at a time and in the order they happened, on whichever node takes them. While a delivery to a webhook is in progress, the other workers deliver to other webhooks. A receiver that does not answer delays only its own webhook, and for at most [webhook] DELIVER_TIMEOUT per attempt. Forgejo delivers events in any order and can send several to one webhook at once, so one slow receiver can keep every worker busy.

After BACKOFF_AFTER_FAILURES deliveries in a row fail, Arbinel waits BACKOFF_MIN before the next one. It doubles the wait after each further failure, up to BACKOFF_MAX. New events queue up in order during the wait and go out once the receiver answers again. A failed delivery is not retried, as in Forgejo, but a user can redeliver it from the webhook’s history.

Arbinel pauses a webhook that has failed PAUSE_AFTER_FAILURES deliveries in a row and has been failing for at least PAUSE_AFTER. With the defaults, a receiver that is down for a deploy or a few hours is never paused.

[webhook]
BACKOFF_AFTER_FAILURES = 3
BACKOFF_MIN = 1m
BACKOFF_MAX = 1h
PAUSE_AFTER_FAILURES = 20
PAUSE_AFTER = 24h

BACKOFF_AFTER_FAILURES = 0 turns waiting and pausing off, and PAUSE_AFTER = 0 turns off only pausing.

Arbinel marks a paused webhook inactive, so it records no new events for it. It records the events that were still waiting as not sent. The owner gets a mail: the user, or the Owners team of an organization. For a system webhook, site administrators get a system notice.

The webhook’s settings page shows when it was paused and a Resume button. Activating the webhook in its form resumes it too. While a webhook only waits after failures, its settings page shows until when, and a test delivery or a redelivery ends the wait.

With [metrics] ENABLED = true, /metrics reports these gauges. Every node reports the whole instance, so take the maximum across nodes, not the sum.

Metric Meaning
gitea_arbinel_webhook_pending_deliveries Deliveries not attempted yet.
gitea_arbinel_webhook_oldest_pending_seconds Age of the oldest of them, 0 when there is none.
gitea_arbinel_webhook_backing_off Webhooks with pending deliveries that wait after failures.
gitea_arbinel_webhook_paused Webhooks that Arbinel paused and nobody resumed.
gitea_arbinel_webhook_queue_length Items in the webhook_sender queue.