One of the problems with synchronous webhooks is that they are executed as soon as the related action is. Since we may call an action multiple times in the process of updating something, this causes only the first action to trigger the hook. This differs from asynchronous execution because in that case, the web hook will be executed after the entire request has completed.
And the corresponding data stores. Defaults to '', meaning do not
load only webhooks with a specific status. This maintains backward
compatibility. However, the call to wc_load_webhooks() within
WooCommerce::load_webhooks() can now only load active webhooks, as
they are the only ones that should be enqueued.
To take care of instantiating a canonical job queue for use across
all of WooCommerce, and by 3rd party code.
Also use this new API for enqueuing webhooks instead of raw Action
Scheduler APIs.
To make it clearer in the database what the args refer to, e.g.
instead of storing the scheduled action's args as:
[1,123]
This patch changes it so that the args are stored as:
["webhook_id":1,"arg":123]
This has no impact on callbacks on the hooks, they are still passed
the args as normal.
This will make it possible in future to run queues specifically for
delivering webhooks, instead of deliering webhooks in the same queue
as other actions, like scheduled payments, emails or other actions
scheduled by other plugins. This can be used to provide better
control over webhook delivery, which allows for sending webhooks more
quickly than if they are only included in batches of other actions.