woocommerce / action-scheduler

A scalable, traceable job queue for background processing large queues of tasks in WordPress. Specifically designed for distribution in WordPress plugins (and themes) - no server access required.
https://actionscheduler.org
GNU General Public License v3.0
640 stars 117 forks source link

CLI runner time limit #937

Open GrigoreMihai opened 1 year ago

GrigoreMihai commented 1 year ago

We would like to limit the running time of the CLI runner, similar to how the action_scheduler_queue_runner_time_limit filter is working for the default runner, but we could not find a way to do this.

Is there any way to do this that we have missed ?

rrennick commented 1 year ago

Is there any way to do this that we have missed ?

You can limit it to how many actions it runs with wp action-scheduler run --batches=N --batch-size=X where N and X are integers.

GrigoreMihai commented 1 year ago

Is there any way to do this that we have missed ?

You can limit it to how many actions it runs with wp action-scheduler run --batches=N --batch-size=X where N and X are integers.

I was aware of this, we want to limit the time that the command runs regardless of the number of actions. For example stop running actions after 10 minutes have passed.

vedanshujain commented 1 year ago

hey @GrigoreMihai it's currently not supported out of the box as of now, but sounds like a good enhancement request. Meanwhile, perhaps you can use the action_scheduler_before_execute to stop the process if a time limit is exceeded.