Action Scheduler

Description

Action Scheduler is a scalable, traceable job queue for background processing large sets of actions in WordPress. It’s specially designed to be distributed in WordPress plugins.

Action Scheduler works by triggering an action 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 occassions.

Think of it like an extension to do_action() which adds the ability to delay and repeat a hook.

Battle-Tested Background Processing

Every month, Action Scheduler processes millions of payments for Subscriptions, webhooks for WooCommerce, as well as emails and other events for a range of other plugins.

It’s been seen on live sites processing queues in excess of 50,000 jobs and doing resource intensive operations, like processing payments and creating orders, at a sustained rate of over 10,000 / hour without negatively impacting normal site operations.

This is all on infrastructure and WordPress sites outside the control of the plugin author.

If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help.

Learn More

To learn more about how to Action Scheduler works, and how to use it in your plugin, check out the docs on ActionScheduler.org.

There you will find:

Credits

Action Scheduler is developed and maintained by Automattic with significant early development completed by Flightless.

Collaboration is cool. We’d love to work with you to improve Action Scheduler. Pull Requests welcome.

Reviews

മാർച്ച്‌ 22, 2023 1 reply
Developers refuse to support their own plugin. I have no use for something that does not work, and something the developers will not support. Cannot and will not recommend to anyone... sadly will not make much of a difference because it's in use in every site that utilizes WooCommerce, but, whatever...
നവംബർ 8, 2022 2 replies
Look, I'm fine with having to do some coding. After all, I want to write my own php code to be called every five minutes or so. But you have to tell me WHERE to put the calls. I've installed your service via plugin, and your usage page (actionscheduler [dot] org [slash] usage) tells me exactly nothing about where I need to make these API calls. Is it function.php in my home WP directory? Can I make these calls from my own self-made directory? Tell me!
ജനുവരി 6, 2022
I had migrated a ton of sites to a new server and (I thought) tested them. But one site malfunctioned when I tested it again and woocommerce would not activate without fatal errors. The error involved the action scheduler Fatal error: Uncaught Error: Class 'Action_Scheduler\Migration\Controller' not found in I had already paid a ton of money to migrate the site from another ecommerce system to woocommerce b efore this latest server change so this was a nightmare. Your plugin fixed it and saved me much heartache. Sincere thanks.
ഒക്ടോബർ 28, 2021
How Action Scheduler only has two reviews is beyond me, though I guess I more typically use it as a library within whatever I'm developing rather than as an actual plugin. Regardless, Action Scheduler is awesome and an absolutely vital contribution to the WordPress community. It's really the only good way to reliably get intensive, bulk recurring actions happening with useful reporting on if scheduled events are happening and such. WAY better than trying to leverage WP's native "wp-cron" task scheduling system. Documentation is good too. What more could you ask?
ജൂലൈ 12, 2021 1 reply
I'm not sure why this plugin hasn't been downloaded more often or hasn't got more positive reviews. It's really helpful for scheduling long running tasks and the logging functionality for viewing and debugging issues is excellent. I wish I had known about it sooner.
Read all 7 reviews

Contributors & Developers

“Action Scheduler” is open source software. The following people have contributed to this plugin.

Contributors

“Action Scheduler” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “Action Scheduler” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

3.6.3 – 2023-09-13

  • Use _doing_it_wrong in initialization check.

3.6.2 – 2023-08-09

  • Add guidance about passing arguments.
  • Atomic option locking.
  • Improve bulk delete handling.
  • Include database error in the exception message.
  • Tweak – WP 6.3 compatibility.

3.6.1 – 2023-06-14

  • Document new optional $priority arg for various API functions.
  • Document the new --exclude-groups WP CLI option.
  • Document the new action_scheduler_init hook.
  • Ensure actions within each claim are executed in the expected order.
  • Fix incorrect text domain.
  • Remove SHOW TABLES usage when checking if tables exist.

3.6.0 – 2023-05-10

  • Add $unique parameter to function signatures.
  • Add a cast-to-int for extra safety before forming new DateTime object.
  • Add a hook allowing exceptions for consistently failing recurring actions.
  • Add action priorities.
  • Add init hook.
  • Always raise the time limit.
  • Bump minimatch from 3.0.4 to 3.0.8.
  • Bump yaml from 2.2.1 to 2.2.2.
  • Defensive coding relating to gaps in declared schedule types.
  • Do not process an action if it cannot be set to in-progress.
  • Filter view labels (status names) should be translatable | #919.
  • Fix WPCLI progress messages.
  • Improve data-store initialization flow.
  • Improve error handling across all supported PHP versions.
  • Improve logic for flushing the runtime cache.
  • Support exclusion of multiple groups.
  • Update lint-staged and Node/NPM requirements.
  • add CLI clean command.
  • add CLI exclude-group filter.
  • exclude past-due from list table all filter count.
  • throwing an exception if as_schedule_recurring_action interval param is not of type integer.

3.5.4 – 2023-01-17

  • Add pre filters during action registration.
  • Async scheduling.
  • Calculate timeouts based on total actions.
  • Correctly order the parameters for ActionScheduler_ActionFactory‘s calls to single_unique.
  • Fetch action in memory first before releasing claim to avoid deadlock.
  • PHP 8.2: declare property to fix creation of dynamic property warning.
  • PHP 8.2: fix “Using ${var} in strings is deprecated, use {$var} instead”.
  • Prevent undefined variable warning for $num_pastdue_actions.

3.5.3 – 2022-11-09

  • Query actions with partial match.

3.5.2 – 2022-09-16

  • Fix – erroneous 3.5.1 release.

3.5.1 – 2022-09-13

  • Maintenance on A/S docs.
  • fix: PHP 8.2 deprecated notice.

3.5.0 – 2022-08-25

  • Add – The active view link within the “Tools > Scheduled Actions” screen is now clickable.
  • Add – A warning when there are past-due actions.
  • Enhancement – Added the ability to schedule unique actions via an atomic operation.
  • Enhancement – Improvements to cache invalidation when processing batches (when running on WordPress 6.0+).
  • Enhancement – If a recurring action is found to be consistently failing, it will stop being rescheduled.
  • Enhancement – Adds a new “Past Due” view to the scheduled actions list table.

3.4.2 – 2022-06-08

  • Fix – Change the include for better linting.
  • Fix – update: Added Action scheduler completed action hook.

3.4.1 – 2022-05-24

  • Fix – Change the include for better linting.
  • Fix – Fix the documented return type.

3.4.0 – 2021-10-29

  • Enhancement – Number of items per page can now be set for the Scheduled Actions view (props @ovidiul). #771
  • Fix – Do not lower the max_execution_time if it is already set to 0 (unlimited) (props @barryhughes). #755
  • Fix – Avoid triggering autoloaders during the version resolution process (props @olegabr). #731 & #776
  • Dev – ActionScheduler_wcSystemStatus PHPCS fixes (props @ovidiul). #761
  • Dev – ActionScheduler_DBLogger.php PHPCS fixes (props @ovidiul). #768
  • Dev – Fixed phpcs for ActionScheduler_Schedule_Deprecated (props @ovidiul). #762
  • Dev – Improve actions table indicies (props @glagonikas). #774 & #777
  • Dev – PHPCS fixes for ActionScheduler_DBStore.php (props @ovidiul). #769 & #778
  • Dev – PHPCS Fixes for ActionScheduler_Abstract_ListTable (props @ovidiul). #763 & #779
  • Dev – Adds new filter action_scheduler_claim_actions_order_by to allow tuning of the claim query (props @glagonikas). #773
  • Dev – PHPCS fixes for ActionScheduler_WpPostStore class (props @ovidiul). #780

3.3.0 – 2021-09-15

  • Enhancement – Adds as_has_scheduled_action() to provide a performant way to test for existing actions. #645
  • Fix – Improves compatibility with environments where NO_ZERO_DATE is enabled. #519
  • Fix – Adds safety checks to guard against errors when our database tables cannot be created. #645
  • Dev – Now supports queries that use multiple statuses. #649
  • Dev – Minimum requirements for WordPress and PHP bumped (to 5.2 and 5.6 respectively). #723

3.2.1 – 2021-06-21

  • Fix – Add extra safety/account for different versions of AS and different loading patterns. #714
  • Fix – Handle hidden columns (Tools → Scheduled Actions) | #600.

3.2.0 – 2021-06-03

  • Fix – Add “no ordering” option to as_next_scheduled_action().
  • Fix – Add secondary scheduled date checks when claiming actions (DBStore) | #634.
  • Fix – Add secondary scheduled date checks when claiming actions (wpPostStore) | #634.
  • Fix – Adds a new index to the action table, reducing the potential for deadlocks (props: @glagonikas).
  • Fix – Fix unit tests infrastructure and adapt tests to PHP 8.
  • Fix – Identify in-use data store.
  • Fix – Improve test_migration_is_scheduled.
  • Fix – PHP notice on list table.
  • Fix – Speed up clean up and batch selects.
  • Fix – Update pending dependencies.
  • Fix – [PHP 8.0] Only pass action arg values through to do_action_ref_array().
  • Fix – [PHP 8] Set the PHP version to 7.1 in composer.json for PHP 8 compatibility.
  • Fix – add is_initialized() to docs.
  • Fix – fix file permissions.
  • Fix – fixes #664 by replacing __ with esc_html__.