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

WP CLI: Schedule new action(s) #255

Open crstauf opened 5 years ago

crstauf commented 5 years ago

Adding an option for devs to easily schedule actions (in bulk) opens up exciting possibilities.

A few uses that come to mind:

  1. Schedule infrequent functions (thinking cleanup, or processing tasks)
  2. Creating new content
  3. Updating WP core or plugins

Granted, there would have to be a corresponding action registered, which maybe makes scheduling events via the CLI irrelevant (because they could be scheduled via PHP). But I'd like to be able to add_action() (in a theme or plugin), and then be able to just leave it there, until I schedule it to run at whatever time.

Here's what I'm envisioning for the command:

wp action-scheduler add <hook name> <scheduled date> <scheduled time> --args=<args in json> --interval=<interval> --limit=<number of actions to schedule>

I realize there are probably more reasons to not implement than to implement, so I defer to the wisdom of the masses. Just an idea I had that I found potentially exciting and powerful for easing tasks and workflows.

thenbrent commented 5 years ago

I can see this being especially useful for testing scheduled actions (especially in bulk). I like the idea and would review/merge a PR for it. 👍

crstauf commented 5 years ago

@thenbrent Submitted PR #263. Please review and let me know of changes you'd like to see. 😄

rrennick commented 4 years ago

CLI subcommands for add, cancel, delete would be great additions. Some additions to the items listed in the description:

--args= would be handled as json automatically with --format=json

Konamiman commented 1 year ago

Hi, we know that this is an old one but we still think this is an interesting idea and we see that some work has actually been done outside of this repository. We'll be glad to take a look at any submitted pull request that implements this feature in Action Scheduler itself.

crstauf commented 1 year ago

Lol four years later: "Can you please do all that work again? We promise we'll consider it this time."

Yes, I'm bitter.

@Konamiman What's changed from four years ago? Can you offer more than a "look"? PRs four years ago were looked at, and left to rot.

crstauf commented 1 year ago

Lol well the response time here isn't exactly instilling confidence.

crstauf commented 1 year ago

Yep, no go.

barryhughes commented 1 year ago

I'm sorry for the further delay. Again, we'd be receptive to any PRs you submit: we can't offer any guarantees, though, beyond doing our best to allocate time toward review and discussion.