Appointments plugin has always used WP-cron to schedule email notifications and reminders to customers. Although, it’s pretty simple and worked so far, it can become clogged, slow and unreliable. This is why we replaced it with Action Scheduler, which is better in every single way. It is also rock-solid and used by main WooCommerce plugins, like Subscriptions and Follow Ups, so we’re really happy to add it to Appointments as well.
Why Action Scheduler?
It is actually not much different than WP-cron, though it is more robust job queue engine that handles a lot of cron tasks better. Below are the most obvious advantages.
When there are multiple email notifications/reminders to be processed, Action Scheduler will process them in a batch of 20 instead of all at once. This makes sure your PHP memory is not exhausted. It can also process more than one batch at a time and will continue until all actions are processed using a maximum of 5 concurrent queues. This makes sure all appointment notifications are always sent on time and are always sent, even when there are batches of 100,000 notifications in queue.
Control over Notifications
You can view past notifications or run/cancel all future notifications, before they are sent out. Previously, you had no insights into notifications being sent out and could not cancel already scheduled notifications. This is now a lot easier and puts you in control.
Record Keeping & Clearing
All events for each action will be logged in the comments table. You can see past and future events inside: WooCommerce > Status > Scheduled Actions. To make sure log record doesn’t clog the database, there are a lot of housekeeping switches:
- Removal of any existing claims on actions which have been sitting in a queue for more than 5 minutes.
- Trashing any actions which were completed more than 1 month ago.
- Actions running more than 5 minutes will be timed out and marked as failed. However, if all callbacks attached to the action were successfully completed sometime after that 5 minute timeout, its status would later be updated to completed.
Manage Scheduled Notifications
You can view past and future notifications inside:
WooCommerce > Status > Scheduled Actions.
You can do the following tasks with scheduled actions:
- Run a pending action
- View the scheduled actions with a specific status, like the all actions which have failed or are in-progress.
- View the log entries for a specific action to find out why it failed.
- Sort scheduled actions by hook name, scheduled date, claim ID or group name.
Changelog for 4.1.0
Improvement - Replaced WP cron with Action scheduler for better transparency and reliability. Improvement - All scheduled actions/emails are available inside WooCommerce > Status > Scheduled Actions. Improvement - WooCommerce Follow-up emails now include customer set timezone. Improvement - Removed $product dependencies in static wc_appointment_form_params script to allow for multiple dynamic appointment forms on the same page. Improvement - Staff label used on all static instances, instead of Providers (dynamic label). Improvement - Removed manual email notifications from commented code. Improvement - Confirmation emails are now sent the same way as admin appointment notifications for better tracking. Fix - Make sure staff quantity cannot be negative. Fix - Do not initiate staff gcal sync, when calendar ID is not set. Fix - Slots with staff availability that is different not working. Fix - Calendar not refreshing with automatically set date/time and multiple staff. Fix - Multiple appointment form shortcodes on same page not working.