-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Testing Action Scheduler
Action Scheduler is used as the default backend for the WooCommerce task queue. It's used for a range of tasks, some that are essential and others less so. Examples:
- Population of look-up tables used by Analytics.
- Running database migrations after a plugin update.
It's generally not something that we expect our users to interact with directly, but is an important component nonetheless. A reasonable way to test it is basically working (as part of our pre-release testing) is outlined below.
Action Scheduler provides an admin screen that can be used to check on the status of actions, and to manually run them. What is essentially the same admin screen is generally found in two separate locations:
- Tools ▸ Scheduled Actions (default screen)
- WooCommerce ▸ Status ▸ Scheduled Actions (duplicate screen: sometimes needed because the above admin screen may be unhooked or hidden by other plugins)
Within this page, you should be able to:
- Search for actions (the hook and argument fields are searched).
- Manually run any pending actions.
- Delete actions (bulk action dropdown).
Navigate to WooCommerce ▸ Settings ▸ Products ▸ Advanced and enable the Product Attribute Lookup Table, making sure the Direct Updates option is not enabled:
Now edit a product, and create a new attribute, then save:
This should result in a scheduled action being generated. Visit either of the Scheduled Actions admin screens, and you should be able to locate an action named woocommerce_run_product_attribute_lookup_update_callback
(if you have a lot of actions you can use the search feature to filter them down):
If Action Scheduler is running as expected, you should find that these become Complete after some time elapses (around two minutes). Or, you can force Action Scheduler to run via WP CLI:
wp action-scheduler run
Without WP CLI, Action Scheduler depends either on WP Cron, or on its own ability to spawn queue-processing requests over HTTP (very similar to how WP Cron works by default). This is not bulletproof, and various factors can stop it from working. In general:
- If you can process the queue via WP CLI, as detailed above, then Action Scheduler itself is probably working just fine.
- If it isn't working without WP CLI, you may wish to check in other WP Cron-based tasks are being processed. Often, if these are blocked, Action Scheduler will also be blocked.
WooCommerce is an open source commerce platform built for WordPress and lovingly crafted by Automattic and the WooCommerce community 💜. Come and work with us!
Contribution
- Set up development environment
- Our Git Flow
- SCSS and JS minification
- Naming conventions
- CSS SASS coding guidelines and naming conventions
- Critical Flows
- API Critical Flows
- String localisation guidelines
- Translating WooCommerce
- Deprecation in core
- Adding Actions and Filters
- Common Issues
- Writing high-quality testing instructions
Release Notes
- Release Testing Instructions
- 3.6.x notes/FAQ
- 2.6.x to 3.0.0 Developer Migration Notes
- Select2 fields not working in 3.0.x
- Thumbnail Image Regeneration in 3.3+
- Customizing image sizes in 3.3+
REST API and CLI
CRUD & Data Descriptions
- Database Description
- CRUD Objects in 3.0
- Order and Order Line Item Data
- Coupon Data
- Customer Data
- Product Data
- Data Stores
Internal APIs
Theming
- Enabling product gallery features (zoom, swipe, lightbox)
- Template File Guidelines for Devs and Theme Authors
Examples / Guides