1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2026-05-30 03:03:14 +00:00

[Web][Dovecot] Add global bandwidth limit for syncjobs

This commit is contained in:
FreddleSpl0it
2026-04-16 13:21:05 +02:00
parent f924b7f0e3
commit 7996cfbb06
5 changed files with 42 additions and 3 deletions
+10
View File
@@ -2277,8 +2277,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$max_parallel = intval($_data['max_parallel']);
if ($max_parallel < 1) { $max_parallel = 1; }
if ($max_parallel > 50) { $max_parallel = 50; }
$max_bps = intval($_data['max_bps']);
if ($max_bps < 0) { $max_bps = 0; }
try {
$redis->Set('SYNCJOBS_MAX_PARALLEL', $max_parallel);
$redis->Set('SYNCJOBS_MAX_BPS', $max_bps);
}
catch (RedisException $e) {
$_SESSION['return'][] = array(
@@ -4660,6 +4663,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$max_parallel = null;
}
$settings['max_parallel'] = intval($max_parallel) ?: 1;
try {
$max_bps = $redis->Get('SYNCJOBS_MAX_BPS');
}
catch (RedisException $e) {
$max_bps = null;
}
$settings['max_bps'] = intval($max_bps) ?: 0;
return $settings;
break;
case 'syncjobs':