aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-12-15 09:18:58 +0000
committerMario <mario@mariovavti.com>2022-12-15 09:18:58 +0000
commit2f687de477c3aeec7ee684fd875e5190ae4c2fbe (patch)
tree41e6cd33ac2dd4df828ad75dba4803c5462735cb
parent5446062b95a28c6b2a28d809ce8ab8ceffa1e922 (diff)
downloadvolse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.tar.gz
volse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.tar.bz2
volse-hubzilla-2f687de477c3aeec7ee684fd875e5190ae4c2fbe.zip
queueworker testing and more logging to syslog
-rw-r--r--Zotlabs/Daemon/Externals.php2
-rw-r--r--Zotlabs/Lib/QueueWorker.php37
2 files changed, 23 insertions, 16 deletions
diff --git a/Zotlabs/Daemon/Externals.php b/Zotlabs/Daemon/Externals.php
index 91fa09044..2c7c7c172 100644
--- a/Zotlabs/Daemon/Externals.php
+++ b/Zotlabs/Daemon/Externals.php
@@ -143,7 +143,7 @@ class Externals {
$AS = new ActivityStreams($message);
if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS);
- Activity::store($importer, $contact['abook_xchan'], $AS, $item);
+ Activity::store($importer, $contact['hubloc_hash'], $AS, $item);
$total++;
}
}
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 {