Skip to content

[Feature request] WP CLI "force" a queue runner upto a limit #1292

Description

@barryhughes

Somewhat inspired by this issue¸ it crossed my mind that, when working via WP CLI, it could be handy to have a means of forcibly creating a queue runner but only if there aren't already n concurrent batches in progress.

To illustrate: suppose the maximum allowed number of concurrent batches (controlled by the action_scheduler_queue_runner_concurrent_batches filter hook) is something low, like 2. If I add a crontab rule like:

* * * * * wp action-scheduler run --force

We'll potentially exceed the concurrent batches limit. Great, it's doing what we're asking, but in reality we may still want to observe some sort of upper limit (ie, rather than simply force the creation of a new queue runner, regardless of how many are already running, support a means of saying 'force this but only if less than 20 are currently in progress').

Possible interfaces:

# Let --force accept an optional argument:
wp action-scheduler run --force=20

# Add a new --force-up-to argument:
wp action-scheduler run --force-up-to=20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions