[add] lock for prevent multi generation of same url
This commit is contained in:
parent
d45aa32900
commit
79457ee9c3
2 changed files with 19 additions and 10 deletions
|
@ -109,6 +109,7 @@ case $renderType in
|
||||||
echo 0
|
echo 0
|
||||||
fi
|
fi
|
||||||
rm "../cache/tmp/$hashUrl.png"
|
rm "../cache/tmp/$hashUrl.png"
|
||||||
|
rm "../cache/tmp/$hashUrl.lock"
|
||||||
;;
|
;;
|
||||||
# thumbnail + complete
|
# thumbnail + complete
|
||||||
tc)
|
tc)
|
||||||
|
@ -125,6 +126,7 @@ case $renderType in
|
||||||
else
|
else
|
||||||
echo 0
|
echo 0
|
||||||
fi
|
fi
|
||||||
|
rm "../cache/tmp/$hashUrl.lock"
|
||||||
;;
|
;;
|
||||||
# thumbnail + realsize
|
# thumbnail + realsize
|
||||||
tr)
|
tr)
|
||||||
|
@ -142,6 +144,7 @@ case $renderType in
|
||||||
else
|
else
|
||||||
echo 0
|
echo 0
|
||||||
fi
|
fi
|
||||||
|
rm "../cache/tmp/$hashUrl.lock"
|
||||||
;;
|
;;
|
||||||
# thumbnail + realsize + complete
|
# thumbnail + realsize + complete
|
||||||
trc)
|
trc)
|
||||||
|
@ -162,6 +165,7 @@ case $renderType in
|
||||||
echo 0
|
echo 0
|
||||||
fi
|
fi
|
||||||
rm "../cache/tmp/$hashUrl.png"
|
rm "../cache/tmp/$hashUrl.png"
|
||||||
|
rm "../cache/tmp/$hashUrl.lock"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,8 @@ function launchScript($url, $hashUrl, $width, $size, $waitForResult = false) {
|
||||||
$renderType = 't';
|
$renderType = 't';
|
||||||
}
|
}
|
||||||
if ($GLOBALS['config']['disableExec'] === false) {
|
if ($GLOBALS['config']['disableExec'] === false) {
|
||||||
|
if (!file_exists('../cache/tmp/'.$hashUrl.'.lock')) {
|
||||||
|
touch('../cache/tmp/'.$hashUrl.'.lock');
|
||||||
chdir('bin/');
|
chdir('bin/');
|
||||||
if ($waitForResult === false) {
|
if ($waitForResult === false) {
|
||||||
exec('bash thumb_server.sh '.$url.' '.$hashUrl.' '.$width.' '.$size.' '.$renderType.' > /dev/null &', $result);
|
exec('bash thumb_server.sh '.$url.' '.$hashUrl.' '.$width.' '.$size.' '.$renderType.' > /dev/null &', $result);
|
||||||
|
@ -158,6 +160,9 @@ function launchScript($url, $hashUrl, $width, $size, $waitForResult = false) {
|
||||||
exec('bash thumb_server.sh '.$url.' '.$hashUrl.' '.$width.' '.$size.' '.$renderType.' 1', $result);
|
exec('bash thumb_server.sh '.$url.' '.$hashUrl.' '.$width.' '.$size.' '.$renderType.' 1', $result);
|
||||||
}
|
}
|
||||||
chdir('../');
|
chdir('../');
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
makeQueueFile($url, $hashUrl, $width, $size, $renderType);
|
makeQueueFile($url, $hashUrl, $width, $size, $renderType);
|
||||||
$result = 0;
|
$result = 0;
|
||||||
|
|
Loading…
Reference in a new issue