diff --git a/bin/cron.php b/bin/cron.php index b2b518676..11205e61a 100755 --- a/bin/cron.php +++ b/bin/cron.php @@ -6,6 +6,7 @@ // Set maximum execution time to 9 minutes as cron runs every 10 minutes. (There should be better way to do this) $start_time = microtime(true); $max_exec_time = (int)Config::get('cron.ttl_cron') * 60; +$intercept_if_expired = (int)Config::get('cron.intercept_if_expired'); set_time_limit($max_exec_time); // Define vars @@ -175,7 +176,7 @@ function cron_interrupt($signo) { //echo $msg . "
"; cron_log(strip_tags($msg), true); - if (microtime(true) - $start_time > $max_exec_time) { + if ($intercept_if_expired && microtime(true) - $start_time > $max_exec_time) { throw new Exception("Cron Intercepted! Started at: $start_date, Intercepted at: " . date('r')); } endforeach; diff --git a/config_default/settings.php b/config_default/settings.php index a1626fe65..4d77253a1 100644 --- a/config_default/settings.php +++ b/config_default/settings.php @@ -81,4 +81,6 @@ 'ttl_cron' => 15, // maximum time to live for log file in minutes 'ttl_lockfile' => 30, -); \ No newline at end of file + // Should cron be intercepted if session time is exceeded? + 'intercept_if_expired' => false, +);