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

Uwe Hermann - February 6, 2006 - 16:01
Version:4.6.x-1.x-dev» HEAD
Assigned to:Anonymous» Uwe Hermann
Status:needs review» fixed

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

Anonymous - February 20, 2006 - 16:31
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.