mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-23 19:45:10 +01:00
Merge remote-tracking branch 'p/ticket/10602' into develop-olympus
* p/ticket/10602: [ticket/10602] Avoid a race condition. [ticket/10602] Use last_queue_run for its intended purpose.
This commit is contained in:
commit
819206a336
@ -715,14 +715,21 @@ class queue
|
||||
|
||||
$lock_fp = $this->lock();
|
||||
|
||||
set_config('last_queue_run', time(), true);
|
||||
|
||||
if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval'])
|
||||
// avoid races, check file existence once
|
||||
$have_cache_file = file_exists($this->cache_file);
|
||||
if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval'])
|
||||
{
|
||||
if (!$have_cache_file)
|
||||
{
|
||||
set_config('last_queue_run', time(), true);
|
||||
}
|
||||
|
||||
$this->unlock($lock_fp);
|
||||
return;
|
||||
}
|
||||
|
||||
set_config('last_queue_run', time(), true);
|
||||
|
||||
include($this->cache_file);
|
||||
|
||||
foreach ($this->queue_data as $object => $data_ary)
|
||||
|
Loading…
x
Reference in New Issue
Block a user