try to fix freeze on lock fail

This commit is contained in:
Jean-Christian Paul Denis 2022-11-27 15:35:03 +01:00
parent 9d0f1fdaab
commit c60fc54b83
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -562,7 +562,7 @@ class activityReport
throw new Exception("Can't open file"); throw new Exception("Can't open file");
} }
// lock file // lock file
if (!flock($fp, LOCK_EX)) { if (!flock($fp, LOCK_EX | LOCK_NB)) {
throw new Exception("Can't lock file"); throw new Exception("Can't lock file");
} }
if ($this->_global) { if ($this->_global) {
@ -585,7 +585,7 @@ class activityReport
if ($this->_global) { if ($this->_global) {
@fclose($this->lock_global); @fclose($this->lock_global);
$this->lock_global = null; $this->lock_global = null;
} else { } elseif ($this->lock_blog) {
@fclose($this->lock_blog); @fclose($this->lock_blog);
$this->lock_blog = null; $this->lock_blog = null;
} }
@ -666,7 +666,6 @@ class activityReport
$this->unlockUpdate(); $this->unlockUpdate();
} catch (Exception $e) { } catch (Exception $e) {
$this->unlockUpdate(); $this->unlockUpdate();
//throw $e;
} }
return true; return true;
@ -719,7 +718,6 @@ class activityReport
} }
} }
} catch (Exception $e) { } catch (Exception $e) {
//var_dump($e);
$done = false; $done = false;
} }