[ticket/13232] Use a cache var with _ to force TTL and shuffle cron tasks

PHPBB3-13232
This commit is contained in:
Nils Adermann 2014-10-27 15:42:26 -07:00
parent d693d91e26
commit df5366a5ca
2 changed files with 4 additions and 3 deletions

View file

@ -5254,7 +5254,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
// Call cron-type script // Call cron-type script
$call_cron = false; $call_cron = false;
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('cron.lock_check')) if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check'))
{ {
$call_cron = true; $call_cron = true;
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
@ -5286,7 +5286,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
} }
else else
{ {
$cache->put('cron.lock_check', true, 300); $cache->put('_cron.lock_check', true, 60);
} }
} }

View file

@ -72,7 +72,8 @@ class manager
* @return \phpbb\cron\task\wrapper|null * @return \phpbb\cron\task\wrapper|null
*/ */
public function find_one_ready_task() public function find_one_ready_task()
{ {
shuffle($this->tasks);
foreach ($this->tasks as $task) foreach ($this->tasks as $task)
{ {
if ($task->is_ready()) if ($task->is_ready())