aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-03 13:50:22 +0000
committerMario <mario@mariovavti.com>2023-01-03 13:50:22 +0000
commit29776ecea2a38eb45f9e0628b1b674c1d7d0df93 (patch)
treefde43ab3d53c26aa961739c9f476564f4ee299bc
parentd2edef5c5a9821337d9985eb00aab4281e480ecf (diff)
downloadvolse-hubzilla-29776ecea2a38eb45f9e0628b1b674c1d7d0df93.tar.gz
volse-hubzilla-29776ecea2a38eb45f9e0628b1b674c1d7d0df93.tar.bz2
volse-hubzilla-29776ecea2a38eb45f9e0628b1b674c1d7d0df93.zip
queueworker: implement auto_queue_worker_sleep setting in frontend
-rw-r--r--Zotlabs/Lib/QueueWorker.php2
-rw-r--r--Zotlabs/Module/Admin/Queueworker.php19
2 files changed, 18 insertions, 3 deletions
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 3a0e70f63..fd2ebd7e1 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -237,7 +237,7 @@ class QueueWorker {
self::$workersleep = ((intval(self::$workersleep) > 100) ? intval(self::$workersleep) : 100);
if (function_exists('sys_getloadavg') && get_config('queueworker', 'load_average_sleep')) {
- // experimental!
+ // very experimental!
$load_average_sleep = true;
}
diff --git a/Zotlabs/Module/Admin/Queueworker.php b/Zotlabs/Module/Admin/Queueworker.php
index b7972b2db..45a09bf04 100644
--- a/Zotlabs/Module/Admin/Queueworker.php
+++ b/Zotlabs/Module/Admin/Queueworker.php
@@ -27,6 +27,9 @@ class Queueworker extends Controller {
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
set_config('queueworker', 'queue_worker_sleep', $queueworkersleep);
+ $auto_queue_worker_sleep = intval($_POST['auto_queue_worker_sleep']);
+ set_config('queueworker', 'auto_queue_worker_sleep', $auto_queue_worker_sleep);
+
goaway(z_root() . '/admin/queueworker');
}
@@ -80,18 +83,30 @@ class Queueworker extends Controller {
$queueworkersleep = get_config('queueworker', 'queue_worker_sleep');
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
+ $auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
+
$sc .= replace_macros(get_markup_template('field_input.tpl'), [
'$field' => [
'queue_worker_sleep',
t('Pause before starting next task'),
$queueworkersleep,
- t('Minimum 100, default 100 microseconds')
+ t('Minimum 100, default 100 microseconds'),
+ '',
+ (($auto_queue_worker_sleep) ? 'disabled' : '')
+ ]
+ ]);
+
+ $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), [
+ '$field' => [
+ 'auto_queue_worker_sleep',
+ t('Automatically adjust pause before starting next task'),
+ $auto_queue_worker_sleep,
]
]);
$tpl = get_markup_template('settings_addon.tpl');
$content .= replace_macros($tpl, [
- '$action_url' => 'queueworker',
+ '$action_url' => 'admin/queueworker',
'$form_security_token' => get_form_security_token('queueworker'),
'$title' => t('Queueworker Settings'),
'$content' => $sc,