Please log progress of cron hooks
dmuth - January 29, 2006 - 03:47
| Project: | Poormanscron |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Uwe Hermann |
| Status: | closed |
Jump to:
Description
I recently had a problem where my web provider told me that I was using up too much CPU. In the process of tracking this issue down, I wrote a "progress indicator" for poormancron that logs the call to each module's cron hook via watchdog. This way, you can determine if a single module is taking too long to run, or even if poormanscron is being killed for too much CPU usage. Here's the code for poormanscron_exit():
//
// Call cron hooks on all modules
//
$modules = module_list();
foreach ($modules as $key => $value) {
if (module_hook($key, 'cron')) {
if (variable_get('poormanscron_log_cron_runs', 1) == 1) {
watchdog('cron', "Calling ${key}_cron()...", WATCHDOG_NOTICE);
}
module_invoke($key, 'cron');
}
}Hope you find this useful!
-- Doug

#1
Fixed in CVS, thanks. I implemented this slighty different and now also log the number of seconds every function needed. I also made this optional, the default is "off". Use administer -> settings -> poormanscron to enable the feature. Please reopen the issue if there are problems...
#2