Loading
Issue #3616519: Make the endpoint optional and send the requests from a queue
The webhook request was sent from hook_entity_insert(), _update() and _delete(). Those hooks run inside the database transaction that SqlContentEntityStorage opens for the save, so every save waited up to the request timeout for the endpoint while the transaction stayed open, and a bulk operation sent one request after the other.
Saving now only puts an item in the "page_refresh_webhook" queue. A queue worker sends the requests on cron:
- An unreachable or broken endpoint suspends the queue, so no request is lost.
- A rejected request, for example HTTP 403, is dropped, because a retry would be rejected the same way.
- A URL that was queued more than once is sent once per run.
- The URL is resolved while the item is queued. Cron usually runs from the command line, where there is no host name for an absolute URL, and a deleted page has no URL left.
The endpoint is optional now. An empty endpoint switches the webhook off without logging an error, so the enabled content types can be identical on all environments while only the environments with an endpoint send requests, for example with a $config override in settings.php.
Closes #3616519
Edited by Jon Minder