--- poormanscron.module.orig 2008-12-19 15:59:28.000000000 -0500 +++ poormanscron.module 2008-12-19 16:01:03.000000000 -0500 @@ -29,7 +29,12 @@ function poormanscron_help($path, $arg) function poormanscron_exit() { // Calculate when the next poormanscron run is due. - $lastrun = variable_get('poormanscron_lastrun', 0); + $lastrun = 0; + db_lock_table('variable'); + $result = db_query("SELECT * FROM {variable} where name = 'poormanscron_lastrun'"); + while ($variable = db_fetch_object($result)) { + $lastrun = unserialize($variable->value); + } $nextrun = $lastrun + 60 * variable_get('poormanscron_interval', 60); // If the configured time has passed, start the next poormanscron run. @@ -38,6 +43,7 @@ function poormanscron_exit() { // If this cron run fails to complete, wait a few minutes before retrying. variable_set('poormanscron_lastrun', $lastrun + 60 * variable_get('poormanscron_retry_interval', 10)); + db_unlock_tables(); // Get the current Drupal messages. Use drupal_set_message() so that // the messages aren't deleted in case the cron run fails and @@ -87,6 +93,8 @@ function poormanscron_exit() { } } } + } else { + db_unlock_tables(); } }