![]() If it fails with an error that can be recorded, that error will be recorded in the log and visible in administration interface, making it possible to trace what went wrong at some point in the past on a site you didn’t have access to in the past. starts (including details of how it was run, e.g.The events logged by default include when an action: Never be left wondering with Action Scheduler’s built-in record keeping.Īll events for each action are logged in the actionscheduler_logs table and displayed in the administration interface. However, if all callbacks attached to the action were to successfully complete sometime after that 5 minute timeout, its status would later be updated to completed. If an action runs for more than 5 minutes, Action Scheduler will assume the action has timed out and will mark it as failed. Housekeepingīefore processing a batch, the scheduler will remove any existing claims on actions which have been sitting in a queue for more than five minutes (or more specifically, 10 times the allowed time limit, which defaults to 30 seconds).Īction Scheduler will also delete any actions which were completed or canceled more than a month ago. This process and the loopback requests will continue until all actions are processed. The PHP process spawned to run the batch will then continue processing batches of 25 actions until it uses 90% of available memory or has been processing for 30 seconds.Īt that point, if there are additional actions to process, an asynchronous loopback request will be made to the site to continue processing actions in a new request. If there are actions to be processed, Action Scheduler will stake a unique claim for a batch of 25 actions and begin processing that batch. not scheduled, have a zero date, meaning they will always be due no matter when the check occurs. Action scheduled to run asynchronously, i.e. actions scheduled to run now or at sometime in the past. When triggered, Action Scheduler will check for scheduled actions that have a due date at or before this point in time i.e. Once per minute on, it will also check on the 'shutdown' hook of WP Admin requests whether there are pending actions, and if there are, it will initiate a queue via an async loopback request. The scheduler will attempt to run every minute by attaching itself as a callback to the 'action_scheduler_run_schedule' hook, which is scheduled using WordPress’s built-in WP-Cron system. How it WorksĪction Scheduler stores the hook name, arguments and scheduled date for an action that should be triggered at some time in the future. If your plugin needs background processing, especially of large sets of tasks, Action Scheduler can help. This is all possible on infrastructure and WordPress sites outside the control of the plugin author.Īction Scheduler is specifically designed for distribution in WordPress plugins (and themes) - no server access required. 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, in 10 concurrent queues at a rate of over 10,000 actions / hour without negatively impacting normal site operations. Battle-Tested Background ProcessingĮvery 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. With the addition of logging and an administration interface, it also provide tracability on your tasks processed in the background. It just so happens, this functionality also creates a robust job queue for background processing large queues of tasks in WordPress. Think of it like an extension to do_action() which adds the ability to delay and repeat a hook. The hook can also be scheduled to run on one or more occassions. ![]() Each hook can be scheduled with unique data, to allow callbacks to perform operations on that data. WordPress Job Queue with Background ProcessingĪction Scheduler is a library for triggering a WordPress hook to run at some time in the future (or as soon as possible, in the case of an async action).
0 Comments
Leave a Reply. |