• Resolved halukay

    (@halukay)


    Hello,
    I have been trying to figure out delayed processing of webhooks. I just read a topic about this issue

    First, Jesse’s explanation in that topic is super helpful to understand how webhooks are processed as I have been scratching my head about this for the last couple days. Is there a link where this information is documented officially as this is not intuitive?

    Second, I don’t think depending on either an admin logged in, or the website traffic provides a reliable solution for scheduled action execution. Here’s why.

    In my case, I have webhooks for subscription created and updated. I need other things to happen immediately when a subscription is created/updated. However, what I’m seeing is the scheduled actions for these webhooks aren’t fired reliably. When I log in as admin, I see a bunch of them just sitting there under the pending actions, happily with their execution time many minutes in past. And when I simply refresh the page, they all get fired.

    I don’t plan to be logged in as admin all the time. I’d like to automate things as much as possible. And I don’t think relying on the website traffic is a good idea either, because traffic is usually sporadic in most cases. No one would want their solution to work immediately sometimes and take forever other times. That would be bad user experience.

    Sorry for the long story – I wanted to provide some context into why this is a significant problem.

    Is there a way to make sure pending actions with execution time in past are fired immediately and automatically (without an admin or any other user action)? Or is there a way to configure specific webhook delivery actions to be executed immediately when queued?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @halukay,

    Is there a link where this information is documented officially as this is not intuitive?

    This is the official WooCommerce.com documentation on Webhooks:

    https://woocommerce.com/document/webhooks/

    Is there a way to make sure pending actions with execution time in past are fired immediately and automatically (without an admin or any other user action)? Or is there a way to configure specific webhook delivery actions to be executed immediately when queued?

    There’s some good information about how things work over with Action Scheduler on https://actionscheduler.org/.

    The scheduler will attempt to run every minute by attaching itself as a callback to the ‘action_scheduler_run_schedule’ hook, which is scheduled using WordPress’s built-in WP-Cron system. Once per minute on, it will also check on the ‘shutdown’ hook of WP Admin requests whether there are pending actions, and if there are, it will initiate a queue via an async loopback request.

    This means that if there is no traffic, nothing will be processed. Most hosts though will let you add a task to the system task scheduler, which means tasks can be processed even when there is no real traffic.

    Here are some resources you may be interested in:

    Hooking WP-Cron Into the System Task Scheduler
    Action Scheduler: WP CLI Documentation

    Hope this points you in the right direction.

    Thread Starter halukay

    (@halukay)

    Hi @rainfallnixfig – This is very helpful. Thank you.

    You’re welcome! Glad to learn it helped.

    If you have any other questions, feel free to create a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Webhooks processing – Take 2’ is closed to new replies.