Fixed locking

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-03-05 19:27:02 +00:00
parent 950a9cc065
commit 31d4c7ef73

View file

@ -63,7 +63,6 @@ function rel_lock($con)
function set_status($con, $name, $status, $type) function set_status($con, $name, $status, $type)
{ {
get_lock($con);
if ($type == "area") if ($type == "area")
{ {
// Get parent ID // Get parent ID
@ -109,18 +108,21 @@ function set_status($con, $name, $status, $type)
$stmt->execute(); $stmt->execute();
$stmt->close(); $stmt->close();
} }
rel_lock($con);
} }
if ($action == "set") if ($action == "set")
{ {
if (isset($_POST['tile']) && $_POST['tile'] != "") if (isset($_POST['tile']) && $_POST['tile'] != "")
{ {
get_lock($con);
set_status($con, $_POST['tile'], $_POST['status'], "tile"); set_status($con, $_POST['tile'], $_POST['status'], "tile");
rel_lock($con);
} }
else if (isset($_POST['area']) && $_POST['area'] != "") else if (isset($_POST['area']) && $_POST['area'] != "")
{ {
get_lock($con);
set_status($con, $_POST['area'], $_POST['status'], "area"); set_status($con, $_POST['area'], $_POST['status'], "area");
rel_lock($con);
} }
else else
{ {
@ -148,7 +150,6 @@ else if ($action == "get-job")
{ {
quit(); quit();
} }
rel_lock($con);
$ret->job = $result->fetch_array()[0]; $ret->job = $result->fetch_array()[0];
if ($ret->job == Null) if ($ret->job == Null)
{ {
@ -158,6 +159,7 @@ else if ($action == "get-job")
{ {
set_status($con, $ret->job, "started", "tile"); set_status($con, $ret->job, "started", "tile");
} }
rel_lock($con);
} }
else if ($action == "get-done") else if ($action == "get-done")
{ {