summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-02-06 16:11:51 +0100
committerAndreas Gohr <andi@splitbrain.org>2011-02-06 16:11:51 +0100
commit26497271fdd53b972af0b3a4411b6ce41a0629c0 (patch)
tree23d52a1e418c49b77a387a9002455fb34069613f /lib/exe
parent7cb9f9eefb2ac37005e5cd31b175489157da3e34 (diff)
downloadrpg-26497271fdd53b972af0b3a4411b6ce41a0629c0.tar.gz
rpg-26497271fdd53b972af0b3a4411b6ce41a0629c0.tar.bz2
correctly wait for a lock in indexer (related to FS#2112)
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/indexer.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index eec8c968c..010ca7987 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -149,6 +149,7 @@ function runIndexer(){
}
// try to aquire a lock
+ $run = 0;
$lock = $conf['lockdir'].'/_indexer.lock';
while(!@mkdir($lock,$conf['dmode'])){
usleep(50);
@@ -156,7 +157,8 @@ function runIndexer(){
// looks like a stale lock - remove it
@rmdir($lock);
print "runIndexer(): stale lock removed".NL;
- }else{
+ }elseif($run++ = 1000){
+ // we waited 5 seconds for that lock
print "runIndexer(): indexer locked".NL;
return false;
}