diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2012-12-05 09:59:59 +0100 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2012-12-05 09:59:59 +0100 |
| commit | 819206a336f812cb1de3d0a5febd073f00c141ec (patch) | |
| tree | dc41235f21f3c25f4766912c3086d359dc07f7f8 | |
| parent | 58a7050fac0f9a2b3f9deea717c01cba98fdb38f (diff) | |
| parent | 1e50116c54ec7ffbaba4622d5481207423ef2bbe (diff) | |
| download | forums-819206a336f812cb1de3d0a5febd073f00c141ec.tar forums-819206a336f812cb1de3d0a5febd073f00c141ec.tar.gz forums-819206a336f812cb1de3d0a5febd073f00c141ec.tar.bz2 forums-819206a336f812cb1de3d0a5febd073f00c141ec.tar.xz forums-819206a336f812cb1de3d0a5febd073f00c141ec.zip | |
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.
| -rw-r--r-- | phpBB/includes/functions_messenger.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 6549693333..e837811c86 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -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) |
