Fix: Parallel troop recall race condition

This commit is contained in:
hdmaniak
2026-03-26 21:48:22 +01:00
parent 0684a60c67
commit 12de46015e
2 changed files with 98 additions and 77 deletions
+12
View File
@@ -4592,6 +4592,18 @@ References: User ID/Message ID, Mode
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('train_village_$wid')");
}
function getEnforceLock($id) {
$id = (int) $id;
$result = mysqli_query($this->dblink, "SELECT GET_LOCK('enforce_$id', 10) AS locked");
$row = mysqli_fetch_assoc($result);
return $row['locked'] == 1;
}
function releaseEnforceLock($id) {
$id = (int) $id;
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('enforce_$id')");
}
/**
* Get the time required to build a specified building
*