diff options
author | Mario <mario@mariovavti.com> | 2022-12-15 09:18:58 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-12-15 09:18:58 +0000 |
commit | 2f687de477c3aeec7ee684fd875e5190ae4c2fbe (patch) | |
tree | 41e6cd33ac2dd4df828ad75dba4803c5462735cb /Zotlabs/Lib/QueueWorker.php | |
parent | 5446062b95a28c6b2a28d809ce8ab8ceffa1e922 (diff) | |
download | volse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.tar.gz volse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.tar.bz2 volse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.zip |
queueworker testing and more logging to syslog
Diffstat (limited to 'Zotlabs/Lib/QueueWorker.php')
-rw-r--r-- | Zotlabs/Lib/QueueWorker.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php index 468383ae2..b4ee6c327 100644 --- a/Zotlabs/Lib/QueueWorker.php +++ b/Zotlabs/Lib/QueueWorker.php @@ -27,7 +27,7 @@ class QueueWorker { switch (ACTIVE_DBTYPE) { case DBTYPE_MYSQL: q('BEGIN'); - q('LOCK TABLE ' . $tablename . ' WRITE'); + //q('LOCK TABLE ' . $tablename . ' WRITE'); break; case DBTYPE_POSTGRES: @@ -41,7 +41,7 @@ class QueueWorker { private static function qcommit() { switch (ACTIVE_DBTYPE) { case DBTYPE_MYSQL: - q("UNLOCK TABLES"); + //q("UNLOCK TABLES"); q("COMMIT"); break; @@ -56,7 +56,7 @@ class QueueWorker { switch (ACTIVE_DBTYPE) { case DBTYPE_MYSQL: q("ROLLBACK"); - q("UNLOCK TABLES"); + //q("UNLOCK TABLES"); break; case DBTYPE_POSTGRES: @@ -199,7 +199,7 @@ class QueueWorker { $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;"); } else { - $work = dbq("SELECT workerq_id FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1;"); + $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;"); } if (!$work) { @@ -256,16 +256,18 @@ class QueueWorker { self::qbegin('workerq'); - if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $workitem = q("SELECT * FROM workerq WHERE workerq_id = %d FOR UPDATE SKIP LOCKED", - $workid - ); - } - else { - $workitem = q("SELECT * FROM workerq WHERE workerq_id = %d", - $workid - ); - } + //if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) { + //$workitem = q("SELECT * FROM workerq WHERE workerq_id = %d FOR UPDATE SKIP LOCKED", + //$workid + //); + //} + //else { + //$workitem = q("SELECT * FROM workerq WHERE workerq_id = %d FOR UPDATE SKIP LOCKED", + //$workid + //); + //} + + $workitem = dbq("SELECT * FROM workerq WHERE workerq_id = $workid"); self::qcommit(); @@ -287,7 +289,12 @@ class QueueWorker { $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; $argv = flatten_array_recursive($argv); $argc = count($argv); + + $rnd = random_string(); + + hz_syslog('PROCESSING: ' . $rnd . ' ' . print_r($argv,true)); $cls::run($argc, $argv); + hz_syslog('COMPLETED: ' . $rnd); // @FIXME: Right now we assume that if we get a return, everything is OK. // At some point we may want to test whether the run returns true/false @@ -295,7 +302,7 @@ class QueueWorker { // to implement some sort of "retry interval" first. self::qbegin('workerq'); - q("delete from workerq where workerq_id = %d", $workid); + dbq("delete from workerq where workerq_id = $workid"); self::qcommit(); } else { |