Action Scheduler has recently been updated to include some major enhancements.
If you are not familiar with Action Schedule, here is the description from the site:
A scalable, traceable job queue for background processing large queues of tasks in WordPress. Designed for distribution in WordPress plugins – no server access required.
The site goes on to explain it a bit more:
Action Scheduler is a library for triggering a WordPress hook to run at some time in the future. Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. The hook can also be scheduled to run on one or more occasions.
Think of it like an extension to
do_action()which adds the ability to delay and repeat a hook.
It just so happens, this functionality also creates a robust job queue for background processing large queues of tasks in WordPress. With the additional of logging and an administration interface, that also provide tracebility on your tasks processed in the background
The Major Enhancements
The two big pieces that come out of this update are for Custom Tables and Async Queue Runner.
Apparently one of the benefits is increased performance from the way custom tables were handled previously. Now all the data is migrated from its current storage to custom tables giving your Woo site:
- 70% reduction in database space
- 68% reduction in new action creation time
- 65% reduction in sorted action list retrieval
Async Queue Runner
As noted in the article:
The async queue runner initiates action processing when an admin user logs into the WordPress administration dashboard. It also uses loopback requests to process multiple batches of actions in a sequence of requests so that instead of processing actions in just one request, once a queue starts processing, it will continue to process actions in a new request until there are no actions to process, or loopback limits are reached.
This new queue runner both reduces the reliance on WP Cron and potentially eliminates the need to use WP CLI due to the higher throughput of action processing.
As a major release the results are that it will break backward compatibility with previous versions … so backup!
Get weekly news on and around the WooCommerce community. Updates to our podcast, news from our weekly roundup and extra news from within and outside the WooCommerce space. I write this myself and it is delivered to your inbox every Saturday morning.