aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-12-12 23:26:45 +0100
committerMario Vavti <mario@mariovavti.com>2022-12-12 23:26:45 +0100
commitc9e170dfcc83a946fda7d4335c136ed40b3c579d (patch)
tree52ee00eefa5ab9f660f3dbf1135b33a11e1cb295
parente3a19469eb6940249ad87662399d14dbf2a79847 (diff)
downloadvolse-hubzilla-c9e170dfcc83a946fda7d4335c136ed40b3c579d.tar.gz
volse-hubzilla-c9e170dfcc83a946fda7d4335c136ed40b3c579d.tar.bz2
volse-hubzilla-c9e170dfcc83a946fda7d4335c136ed40b3c579d.zip
queueworker: introduce new interval config queueworker.queue_interval - defaults to 500000 microseconds. No config UI yet.
-rw-r--r--Zotlabs/Daemon/Cron.php8
-rw-r--r--Zotlabs/Daemon/Poller.php10
-rw-r--r--Zotlabs/Lib/Libsync.php6
-rw-r--r--Zotlabs/Lib/QueueWorker.php13
-rw-r--r--include/hubloc.php5
-rw-r--r--include/network.php6
-rw-r--r--view/tpl/admin_site.tpl4
7 files changed, 23 insertions, 29 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index b8bcbe3a2..640f06102 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -52,7 +52,7 @@ class Cron {
require_once('include/account.php');
remove_expired_registrations();
- $interval = get_config('system', 'delivery_interval', 3);
+ $interval = get_config('queueworker', 'queue_interval', 500000);
// expire any expired items
@@ -69,7 +69,7 @@ class Cron {
Master::Summon(['Notifier', 'drop', $rr['id']]);
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
}
@@ -102,7 +102,7 @@ class Cron {
Master::Summon(array('Directory', $rr['channel_id'], 'force'));
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
}
@@ -159,7 +159,7 @@ class Cron {
Master::Summon(array('Notifier', 'wall-new', $rr['id']));
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
}
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index b43b814f7..0fdc3da16 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -17,13 +17,13 @@ class Poller {
}
}
+ $interval = get_config('queueworker', 'queue_interval', 500000);
- $interval = intval(get_config('system', 'poll_interval'));
+/*
if (!$interval) {
$interval = ((get_config('system', 'delivery_interval') === false) ? 3 : intval(get_config('system', 'delivery_interval')));
}
-/*
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/poller';
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
@@ -109,7 +109,7 @@ class Poller {
Master::Summon(['Onepoll', $contact['abook_id']]);
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
@@ -175,7 +175,7 @@ class Poller {
Master::Summon(['Onepoll', $contact['abook_id']]);
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
}
@@ -201,7 +201,7 @@ class Poller {
Master::Summon(['Onedirsync', $rr['ud_id']]);
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
}
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 2d6d86d78..f844c63b5 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -135,9 +135,7 @@ class Libsync {
$info['collection_members'] = $r;
}
-
- $interval = ((get_config('system', 'delivery_interval') !== false)
- ? intval(get_config('system', 'delivery_interval')) : 2);
+ $interval = get_config('queueworker', 'queue_interval', 500000);
logger('Packet: ' . print_r($info, true), LOGGER_DATA, LOG_DEBUG);
@@ -173,7 +171,7 @@ class Libsync {
*/
if ($interval) {
- @time_sleep_until(microtime(true) + (float)$interval);
+ usleep($interval);
}
}
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 9f60e3315..468383ae2 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -66,7 +66,7 @@ class QueueWorker {
return;
}
- public static function Summon(&$argv) {
+ public static function Summon($argv) {
if ($argv[0] !== 'Queueworker') {
@@ -102,19 +102,18 @@ class QueueWorker {
return;
}
self::qcommit();
- logger('INSERTED: ' . $workinfo_json, LOGGER_DEBUG);
+ hz_syslog('INSERTED: ' . $workinfo_json, LOGGER_DEBUG);
}
- $argv = [];
$workers = self::GetWorkerCount();
if ($workers < self::$maxworkers) {
- logger("Less than max active workers ($workers) max = " . self::$maxworkers . ".", LOGGER_DEBUG);
+ hz_syslog("Less than max active workers ($workers) max = " . self::$maxworkers . ".", LOGGER_DEBUG);
$phpbin = get_config('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
}
}
- public static function Release(&$argv) {
+ public static function Release($argv) {
if ($argv[0] !== 'Queueworker') {
@@ -152,7 +151,7 @@ class QueueWorker {
self::qcommit();
logger('INSERTED: ' . $workinfo_json, LOGGER_DEBUG);
}
- $argv = [];
+
self::Process();
}
@@ -228,7 +227,7 @@ class QueueWorker {
public static function Process() {
if (!self::GetWorkerID()) {
- logger('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
+ hz_syslog('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
killme();
}
diff --git a/include/hubloc.php b/include/hubloc.php
index edd452dd3..965725cba 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -155,8 +155,7 @@ function remove_obsolete_hublocs() {
logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.');
- $interval = ((get_config('system', 'delivery_interval') !== false)
- ? intval(get_config('system', 'delivery_interval')) : 2 );
+ $interval = get_config('queueworker', 'queue_interval', 500000);
foreach($r as $rr) {
q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d",
@@ -170,7 +169,7 @@ function remove_obsolete_hublocs() {
Master::Summon(array('Notifier', 'refresh_all', $x[0]['channel_id']));
if($interval) {
- @time_sleep_until(microtime(true) + (float) $interval);
+ usleep($interval);
}
}
}
diff --git a/include/network.php b/include/network.php
index 52c21d808..f0642d8f7 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1479,9 +1479,7 @@ function do_delivery($deliveries, $force = false) {
*/
- $interval = ((get_config('system','delivery_interval') !== false)
- ? intval(get_config('system','delivery_interval')) : 2 );
-
+ $interval = get_config('queueworker', 'queue_interval', 500000);
$deliveries_per_process = intval(get_config('system','delivery_batch_count'));
@@ -1502,7 +1500,7 @@ function do_delivery($deliveries, $force = false) {
$deliver = [];
if($interval) {
- @time_sleep_until(microtime(true) + (float) $interval);
+ usleep($interval);
}
}
}
diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl
index ae63edc04..bad68361b 100644
--- a/view/tpl/admin_site.tpl
+++ b/view/tpl/admin_site.tpl
@@ -72,10 +72,10 @@
{{include file="field_input.tpl" field=$proxy}}
{{include file="field_input.tpl" field=$proxyuser}}
{{include file="field_input.tpl" field=$timeout}}
- {{include file="field_input.tpl" field=$delivery_interval}}
+ {{**include file="field_input.tpl" field=$delivery_interval**}}
{{include file="field_input.tpl" field=$delivery_batch_count}}
{{**include file="field_input.tpl" field=$force_queue**}}
- {{include file="field_input.tpl" field=$poll_interval}}
+ {{**include file="field_input.tpl" field=$poll_interval**}}
{{include file="field_input.tpl" field=$maxloadavg}}
{{include file="field_input.tpl" field=$default_expire_days}}
{{include file="field_input.tpl" field=$active_expire_days}}