Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could I pause scheduled actions? #1046

Closed
NicolaModugno opened this issue Mar 28, 2024 · 2 comments
Closed

Could I pause scheduled actions? #1046

NicolaModugno opened this issue Mar 28, 2024 · 2 comments
Labels
type: support request Issues submitted that are not bugs or enhancements but support requests (both dev and non-dev).

Comments

@NicolaModugno
Copy link

Hello, everyone,
I am working on a data import system that has to work constantly (in loop) to update local data from a remote source.
On some occasions the amount of data to be imported is large and I have been wondering how to use AS to handle it.

Is there any way to "pause" the execution of certain actions?

Let us assume that we are downloading a large dataset to import: I could schedule all the actions needed to import the data straight away (as is logical), but in this way, if needed, I do not have the option of pausing the import (pausing specific scheduled actions or all actions by group name) to restart it later. The only alternative would be to create a few actions at a time after checking whether the import can continue, but then the management would be more complex and the procedure less efficient in general.

What do you think?
I look forward to your considerations and thank you for this fantastic tool!

@barryhughes
Copy link
Member

barryhughes commented Mar 28, 2024

That's an interesting use case. Unfortunately, though, it's not something that's directly supported.

The only alternative would be to create a few actions at a time after checking whether the import can continue, but then the management would be more complex and the procedure less efficient in general.

The above note makes me think this option may not be attractive to you, but my first thought was that you could use a recurring action and, if the pause is in effect, it would simply exit early without doing anything. To do this, you might need to store any data the import job needs outside of the action arguments.

$action_ids = ActionScheduler::store()->query_actions( $criteria );

☝🏼 Another option is using something like the above to fetch the actions you are interested in, and then simulate a pause by re-scheduling them into the far future, or even cancelling them, or perhaps apply a custom status of some kind.

Cancellation is already supported via as_unschedule_action(). However, the other options I mentioned would require custom code (and, of course, you'd probably need to write some corresponding code to un-pause). This is probably the less efficient strategy.

@barryhughes barryhughes added the type: support request Issues submitted that are not bugs or enhancements but support requests (both dev and non-dev). label Mar 28, 2024
@barryhughes
Copy link
Member

It doesn't seem like there are any further questions here, so will go ahead and close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: support request Issues submitted that are not bugs or enhancements but support requests (both dev and non-dev).
Projects
None yet
Development

No branches or pull requests

2 participants