mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00: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
1 changed files with 10 additions and 3 deletions
|
@ -715,14 +715,21 @@ class queue
|
||||||
|
|
||||||
$lock_fp = $this->lock();
|
$lock_fp = $this->lock();
|
||||||
|
|
||||||
set_config('last_queue_run', time(), true);
|
// avoid races, check file existence once
|
||||||
|
$have_cache_file = file_exists($this->cache_file);
|
||||||
if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval'])
|
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);
|
$this->unlock($lock_fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_config('last_queue_run', time(), true);
|
||||||
|
|
||||||
include($this->cache_file);
|
include($this->cache_file);
|
||||||
|
|
||||||
foreach ($this->queue_data as $object => $data_ary)
|
foreach ($this->queue_data as $object => $data_ary)
|
||||||
|
|
Loading…
Add table
Reference in a new issue