action-scheduler icon indicating copy to clipboard operation
action-scheduler copied to clipboard

CLI runner time limit

Open GrigoreMihai opened this issue 1 year ago • 3 comments

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 ?

GrigoreMihai avatar Apr 10 '23 15:04 GrigoreMihai

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.

rrennick avatar Apr 10 '23 16:04 rrennick

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.

GrigoreMihai avatar Apr 10 '23 17:04 GrigoreMihai

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.

vedanshujain avatar Apr 11 '23 14:04 vedanshujain