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

Feature Request: cron event --exclude #55

Closed
maxledoux opened this issue Jan 28, 2020 · 3 comments · Fixed by #97
Closed

Feature Request: cron event --exclude #55

maxledoux opened this issue Jan 28, 2020 · 3 comments · Fixed by #97

Comments

@maxledoux
Copy link

Related to #27 and its possible solution #38, but along a different line.

Here's what I'm doing.

I have a large number of crons on my site because I use an RSS Importer to import posts from dozens of feeds. The RSS Importer checks the feeds once per (hour, 2 hours, etc., it varies). I do try to stagger the crons so they don't all run at once, but given all the other WP core related crons and crons for future publishing posts, and etc., etc., I usually have at least half a dozen crons that are ready to run Now.

I have WP Cron disabled and on my server I run the following:

*/5  *  *  *  *       cd /home/public_html && /usr/local/bin/wp cron event run 'publish_future_post' --due-now
*/5  *  *  *  *       cd /home/public_html && /usr/local/bin/wp cron event run 'fetch_single_feed_hook' --due-now
*/8  *  *  *  *       cd /home/public_html && /usr/local/bin/wp cron event run  --due-now

The problem:

Sometimes wp cron event run 'fetch_single_feed_hook' --due-now has not finished firing by the time the wp cron event run --due-now starts, and then I get duplicate results. This is the problem described in #27.

My suggestion:

If there was an --exclude option to the cron event command, I could run something like:

wp cron event run --due-now --exclude=fetch_single_feed_hook,publish_future_post

Then only the other crons due Now would run, and not the ones that potentially are already running separately.

@davisben
Copy link

I ran into similar issue where I have a long running hook that I'd like to be able to run less frequently then everything else. I'll work on a pull request.

@danielbachhuber
Copy link
Member

I'm amenable to this!

@davisben @maxledoux Would either of you like to reconstitute a pull request?

@rutviksavsani
Copy link
Contributor

@danielbachhuber Is this still a valid issue and requires a pull request?
I see this comment #80 (comment) but it is not yet merged so wanted to confirm before proceeding forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants