From c9e170dfcc83a946fda7d4335c136ed40b3c579d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 12 Dec 2022 23:26:45 +0100 Subject: queueworker: introduce new interval config queueworker.queue_interval - defaults to 500000 microseconds. No config UI yet. --- include/hubloc.php | 5 ++--- include/network.php | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'include') 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); } } } -- cgit v1.2.3