WooCommerce Action Scheduler bloat

Hand with old fashioned stopwatch timer

Action Scheduler is an open-source library for WordPress in use by premium plugins that perform sometimes heavy, time based operations. Here’s some main points about it:

  • Comes bundled into WooCommerce core software
  • Features an administrative user interface and one month worth of activity logs
  • Has its own governor with heartbeat coming from WP Cron, therefore is a sub cron system
  • Examples of what it does include: renewal payments for WooCommerce Subscriptions, webhooks for WooCommerce core, emails and other events.

Action Scheduler can become a problem on sites running a high volume of plugins (typically over 30) where multiple services can compete for it and raise the customization risks, bugs. I’ve observed it overloading server resources when WooCommerce webhooks are over active or have a propensity to loop. For example, webhook entries that make WooCommerce tell Klaviyo and Printful each time an order and product is updated can loop if there’s other website activities, cron, tasks, or remote requests firing the same update hook. Scheduled items may also retry upon failure.

I’ve had to manually blow out Action Scheduler logs, completed, and failed actions to unlock the governor AKA “claim groups” and gain visibility into what’s running. I’ve also had to pause WooCommerce Webhooks that are overly chatty, such as the product updated webhooks mentioned above.

Some plugins cause PHP fatal errors that result in failing jobs within the Action Scheduler. The biggest offender I’ve seen is Google Product Feeds and JustUno plugins. Action Scheduler notwithstanding; I’ve observed certain WooCommerce hooks that when called must be unhooked, customized, then re-hooked in order to prevent infinite looping – where the process itself fires the same hook being executed. Examine your PHP error logs! Loops will produce out-of-memory and max-execution-time errors.

It’s important to understand what each plugin and custom function in your child theme or Code Snippets is doing. Gain visibility by examining logs such as those within Action Scheduler.