This feature request may also solve the http://drupal.org/node/24001 issue with thrashed user session state.
This request comes out of the following situation:
- Logging in to Drupal sites using stored passwords (browser feature), is very slow, as the browser password auto-fill-in does not finish until poormanscron has finished. So the user has to wait for poormanscron to finish before the login information is filled in. The response time is longer the more syndication sources the actual site is using.
I suggest adding a setting that allows the administrator to specify the amount of seconds/minutes one want poormanscron to wait before execution, whenever it is triggered by anonymous users. There should be a way to run it instantly as when typing cron.php in the URL, so the new setting should perhaps only be related to anonymous?
PS. There is another nice side effect of being able to set it to several minutes:
Then a user can log in, post a quick post, and have the new post instantly taking part in the notification that the delayed cron will trigger a few minutes later. It should be possible to set as long as 15 minutes (or more). No need to be able to specify seconds, I think.
Comments
Comment #1
fgmBumping to current version, because this is still current.
Adding a setting to make poormanscron only fire on authenticated sessions might be interesting for some sites where the site admin/team is often online, but might be inappropriate for "publish" sites, which receive mostly anonymous visitors, which are served pages from cache.
Going further, 5.0 agressive caching is already incompatible with the module anyway.
What do oyther think of this ?
Comment #2
peterx commentedSomething I implemented on 5.0. 5.0 has stuff that uses Curl. Curl gives a way to quickly return to the user. If you are already using Curl then the Curl part of this approach will work. The second part is an alternative for occasions when Curl is not available. I created the second part then added the first part without bothering to delete the second part.
1/ Rename poormanscron_exit to poormanscron_exit_process then add the following new poormanscron_exit followed by the extra menu entry.
poormanscron_exit will start poormanscron_exit_process as another page request and wait only for the header. Curl is instructed, by the NOBODY option, to get only the header which means Curl should get a status code of 200 immediately the headers are sent and return to poormanscron_exit.
I use this on a site where Drupal is running from the base directory, not from a subdirectory and am not using multisite.
2/
The test for $_REQUEST['form_id'] should bypass poormanscron whenever the processing is within pages that pass forms information the the next page. If the Curl stuff is not usable then the check for form_id will take care of some problems with slow responses at the wrong time. You could add in other checks to exclude occasions where you are within items called from Ajax.
Comment #3
peterx commentedNot much point in Curling if it is not time so add the following check after the check of arg(0) and for form_id.
Comment #4
sunDid you already try to register drupal_run_cron() as a shutdown function?
http://php.net/manual/en/function.register-shutdown-function.php
Comment #5
sunOf course, drupal_run_cron() is related to #119094: Use drupal_cron_run() (fixes FeedAPI compatibility problem and multiple simultaneous runs)
Comment #6
dave reidWill be fixed with #589438: PoormansCron: The Next Generation.