Fix performance issues

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-04-17 00:49:56 +02:00
parent a15af89dd6
commit 7d7aee986a

View file

@ -129,20 +129,12 @@ if ($action == "set")
quit(); quit();
} }
} }
else if ($action == "get-job") else if ($action == "get-job" && isset($_POST["type"]) && $_POST["type"] != "")
{ {
get_lock($con); get_lock($con);
if (isset($_POST["additional-type"]) && $_POST["additional-type"] != "") $sql = "SELECT id FROM tile WHERE status_id = (SELECT id FROM status WHERE name = ?) ORDER BY parent_id LIMIT 1";
{ $stmt = $con->prepare($sql);
$sql = "SELECT id FROM tile WHERE status_id = (SELECT id FROM status WHERE name = 'pending') OR status_id = (SELECT id FROM status WHERE name = ?) ORDER BY parent_id LIMIT 1"; $stmt->bind_param("s", $_POST["type"]);
$stmt = $con->prepare($sql);
$stmt->bind_param("s", $_POST["additional-type"]);
}
else
{
$sql = "SELECT id FROM tile WHERE status_id = (SELECT id FROM status WHERE name = 'pending') ORDER BY parent_id LIMIT 1";
$stmt = $con->prepare($sql);
}
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
$stmt->close(); $stmt->close();