Commit 9eefd38a authored by Carsten  Rose's avatar Carsten Rose

Implement workaround: set expire timestamp always one second to earlier. A...

Implement workaround: set expire timestamp always one second to earlier. A relock will always see an expired lock. This might be dangerous for exactly one second.
parent 84ad7d04
Pipeline #2267 passed with stages
in 2 minutes and 39 seconds
......@@ -272,7 +272,8 @@ class Dirty {
$record = $this->dbArray[$this->dbIndexData]->sql("SELECT * FROM $tableName WHERE $primaryKey=?", ROW_EXPECT_1, [$recordId], "Record to lock not found.");
$expire = date('Y-m-d H:i:s', strtotime("+" . $tableVars[F_RECORD_LOCK_TIMEOUT_SECONDS] . " seconds"));
# Dirty workaround: setting the 'expired timestamp' minus 1 second guarantees that the client ask for relock always if the timeout is expired.
$expire = date('Y-m-d H:i:s', strtotime("+" . $tableVars[F_RECORD_LOCK_TIMEOUT_SECONDS] - 1 . " seconds"));
// Write 'dirty' record
$this->dbArray[$this->dbIndexQfq]->sql("INSERT INTO Dirty (`sip`, `tableName`, `recordId`, `expire`, `recordHashMd5`, `feUser`, `qfqUserSessionCookie`, `dirtyMode`, `remoteAddress`, `created`) " .
"VALUES ( ?,?,?,?,?,?,?,?,?,? )", ROW_REGULAR,
......@@ -394,7 +395,6 @@ class Dirty {
return $answer;
}
if ($formMode == FORM_DELETE) {
// Check if the lock is timed out
if ($lockTimeout > 0 && $rcRecordDirty[DIRTY_EXPIRE] < date('Y-m-d H:i:s')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment