aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/QueueWorker.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-12-22 10:02:31 +0000
committerMario <mario@mariovavti.com>2022-12-22 10:02:31 +0000
commita7ad117a83fb865fb7ab926a993d39294c07a0d1 (patch)
tree8b9261baa0de00a23fd4398bef32bd3b298303a1 /Zotlabs/Lib/QueueWorker.php
parent1ba44fc117656233be82828e708d50cb3dcfc2d9 (diff)
downloadvolse-hubzilla-a7ad117a83fb865fb7ab926a993d39294c07a0d1.tar.gz
volse-hubzilla-a7ad117a83fb865fb7ab926a993d39294c07a0d1.tar.bz2
volse-hubzilla-a7ad117a83fb865fb7ab926a993d39294c07a0d1.zip
there is no point in wrapping single queries into a transaction
Diffstat (limited to 'Zotlabs/Lib/QueueWorker.php')
-rw-r--r--Zotlabs/Lib/QueueWorker.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index eecf79907..8f816a619 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -21,7 +21,7 @@ class QueueWorker {
'Directory' => 1
];
- // Exceptions for processtimeout value.
+ // Exceptions for processtimeout ($workermaxage) value.
// Currently the value is overriden with 3600 seconds (1h).
public static $long_running_cmd = [
'Queue'
@@ -145,6 +145,7 @@ class QueueWorker {
$workers = dbq("select count(distinct workerq_reservationid) as total from workerq where workerq_reservationid is not null");
logger("WORKERCOUNT: " . $workers[0]['total'], LOGGER_DEBUG);
+
return intval($workers[0]['total']);
}
@@ -174,7 +175,7 @@ class QueueWorker {
self::qstart();
- // This is probably the better solution but is not supported by mariadb < 10.6
+ // This is probably the better solution but is not supported by mariadb < 10.6 which is still used a lot.
// $work = dbq("SELECT workerq_id FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1 FOR UPDATE SKIP LOCKED;");
$work = dbq("SELECT workerq_id, workerq_cmd FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1 FOR UPDATE;");
@@ -255,9 +256,7 @@ class QueueWorker {
usleep(self::$workersleep);
- self::qstart();
$workitem = dbq("SELECT * FROM workerq WHERE workerq_id = $workid");
- self::qcommit();
if (isset($workitem[0])) {
// At least SOME work to do.... in case there's more, let's ramp up workers.
@@ -291,9 +290,7 @@ class QueueWorker {
// and requeue the work to be tried again if needed. But we probably want
// to implement some sort of "retry interval" first.
- self::qstart();
dbq("delete from workerq where workerq_id = $workid");
- self::qcommit();
}
else {
logger("NO WORKITEM!", LOGGER_DEBUG);