Posts "Missed Schedule"
I had some scheduled posts to the Philosophy Commons recently that say "missed schedule" in the dashboard and never went up (see screenshot image attached). Do you have any idea what this means or how to stop it from happening?
Thanks for any insight!
#2 Updated by Boone Gorges over 6 years ago
- Category name set to WordPress (misc)
- Assignee changed from Dominic Giglio to Daniel Jones
- Target version set to 1.7.18
Marilynn, sorry for the delay on this one. Dan, would you mind taking a look at this? I'm not certain how the "Missed Schedule" thing comes up in WP.
#3 Updated by Daniel Jones over 6 years ago
It looks like this is usually a problem with how the server interacts with the default WP Cron. One quick fix is this plugin: https://wordpress.org/plugins/wp-missed-schedule/
I'd make sure to read the 1-star review of it though and see if you still want to install it - the author of plugin has it output some extra HTML that lets him track his user base, and it adds some other weird output, too. It seems like it works though, and most people haven't had any trouble with it.
The other option would be for us to try and figure out where the issue is between the server and WP Cron (something at least kind of like this: http://www.trickspanda.com/2014/03/fix-missed-schedule-posts-wordpress/), but I don't think I can do that on my local setup.
#4 Updated by Boone Gorges over 6 years ago
Dan, thanks for researching this a bit. The technique used by the plugin looks OK to me. The obfuscated code mentioned by one of the 1-star reviews appears to have been removed, but it's true that it still leaves a calling card in the form of an HTML comment. Looking over the changeset history of the code, I'm not really comfortable installing the plugin (and being subject to future updates) but I think we could probably just tear out the parts that we want. Could I ask you to build an mu-plugin that does that? Basically, I'd say do the following: set up an hourly scheduled task that runs a query similar to what happens in the plugin's `wpmu_init()`. This will be a good chance for you to experience the joy that is WP's pseudo-cron system :-D
#5 Updated by Daniel Jones over 6 years ago
Here's my first crack at this: https://github.com/cuny-academic-commons/cac/commit/ed510fdc9eec8442599ada0d7a5dcc246f485203
I think it's fairly straightforward, although I wasn't able to test very carefully since it seems like a lot of the issues are around particular server setups.
I took the method of finding overdue posts from the file in Wordpress core (wp-admin/includes/class-wp-posts-list-table.php) that outputs the "Missed schedule" line. I was at least able to test that the query works and that I am in fact scheduling an event, although something weird was happening where wp_next_scheduled() was returning a timestamp that was less than what time() was returning, suggesting that the next time it was supposed to be run was actually in the past. That was a little disconcerting, not sure if it's something weird with timezones?
Let me know what you think!
#13 Updated by Boone Gorges over 6 years ago
- Status changed from Assigned to Resolved
Thanks for your patience here. I think that Dan's plugin should fix this issue. The fix will roll out sorta slowly (it depends on a site's getting traffic) but it should be fully complete within a day or so. Tentatively marking as resolved. https://github.com/cuny-academic-commons/cac/commit/98f7c7b53ba5ab31184e6f496abef33b9f0b687b
#15 Updated by Boone Gorges over 6 years ago
- Status changed from Resolved to Assigned
- Assignee changed from Boone Gorges to Daniel Jones
- Target version changed from 1.8.1 to Future release
After this fix was deployed, it caused CPU utilization to jump, almost bringing down the server. I'm not sure why - the changeset looks OK to me at a glance - but for now I have disabled it. https://github.com/cuny-academic-commons/cac/commit/dbe63309a46e58ca20adf7c2ffedfdc9d61dc4bd
Dan, can I ask you to take another dive into what's going on here? If there's a way that it can be addressed in WP, that might be better still. Probably related: https://core.trac.wordpress.org/ticket/29581