Description
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.