summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2023-05-11 15:27:25 +0200
committerUrban Müller2023-05-11 15:27:25 +0200
commit77da6f5583070b465b80e0ffca991ebb2aae171f (patch)
tree16bb2c06a64bb57c116e594dfbfc36ded4a299c2
parent07437f705b52888cea0fa282401b6df15ab860ce (diff)
downloaditools-77da6f5583070b465b80e0ffca991ebb2aae171f.tar.gz
itools-77da6f5583070b465b80e0ffca991ebb2aae171f.tar.bz2
itools-77da6f5583070b465b80e0ffca991ebb2aae171f.zip
store mtime before lock gets touched
-rw-r--r--it_url.class6
1 files changed, 4 insertions, 2 deletions
diff --git a/it_url.class b/it_url.class
index cfa2bef..8594006 100644
--- a/it_url.class
+++ b/it_url.class
@@ -761,13 +761,15 @@ static function _expired($path, $maxage, $randomexpire = 0)
*/
static function _lock($path, $p = [])
{
+ $mtime = @filemtime("$path.lock");
+
if (!($fh = it::fopen("$path.lock", "w")))
return false;
if (!flock($fh, LOCK_EX | LOCK_NB))
{
- if (($mtime = @filemtime("$path.lock")) && (time() - $mtime > 30))
- it::error((array)$p['it_error'] + ['title' => "stale lock epired for $path"]); # FIXME 2023-07 DF remove stale lock expiration if never triggered
+ if ($mtime && (time() - $mtime > 30))
+ it::error((array)$p['it_error'] + ['title' => "stale lock epired for $path"]); # FIXME 2024-07 DF remove stale lock expiration if never triggered
else
return false;
}