// If the admin worker is enabled we send all events synchronously, as we can't guarantee timely delivery otherwise.
// Additionally, all app lifecycle events are sent synchronously as those can lead to nasty race conditions otherwise.
if ($this->isAdminWorkerEnabled ||
$event instanceof AppDeletedEvent ||
$event instanceof AppChangedEvent
) { Profiler::
trace('webhook::dispatch-sync',
function D
) use ($userLocale,
$languageId,
$affectedRoleIds,
$event,
$webhooksForEvent): void
{ $this->
callWebhooksSynchronous($webhooksForEvent,
$event,
$affectedRoleIds,
$languageId,
$userLocale);
});
return;
} Profiler::
trace('webhook::dispatch-async',
function D
) use ($userLocale,
$languageId,
$affectedRoleIds,
$event,
$webhooksForEvent): void
{ $this->
dispatchWebhooksToQueue($webhooksForEvent,
$event,
$affectedRoleIds,
$languageId,
$userLocale);
});
} private function getWebhooks(): WebhookCollection
{ if ($this->webhooks
) { return $this->webhooks;
} $criteria =
new Criteria();
$criteria->
setTitle('apps::webhooks'
);