1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2026-06-11 09:00:29 +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':
+1
View File
@@ -373,6 +373,7 @@
"subject": "Betreff",
"success": "Erfolg",
"syncjobs": "Sync-Jobs",
"syncjobs_max_bps": "Globales Bandbreitenlimit (Bytes/s)<br><small>Maximale Transferrate pro Sync-Job in Bytes pro Sekunde. 0 = kein Limit. Wird durch ein pro Sync-Job gesetztes Limit überschrieben.</small>",
"syncjobs_max_parallel": "Maximale Anzahl paralleler Sync-Jobs<br><small>Wie viele imapsync-Prozesse dürfen gleichzeitig laufen. 1 = sequentiell (aktuelles Verhalten).</small>",
"sys_mails": "System-E-Mails",
"task": "Aufgabe",
+1
View File
@@ -383,6 +383,7 @@
"subject": "Subject",
"success": "Success",
"syncjobs": "Sync jobs",
"syncjobs_max_bps": "Global bandwidth limit (bytes/s)<br><small>Maximum transfer rate per sync job in bytes per second. 0 = no limit. Overridden by a per-job limit.</small>",
"syncjobs_max_parallel": "Maximum parallel sync jobs<br><small>How many imapsync processes are allowed to run in parallel. 1 = sequential (legacy behavior).</small>",
"sys_mails": "System mails",
"task": "Task",
@@ -14,6 +14,12 @@
<input type="number" class="form-control" id="syncjobs_max_parallel" name="max_parallel" value="{{ sj_data.max_parallel }}" min="1" max="50" required>
</div>
</div>
<div class="row mb-4">
<label class="col-sm-4 control-label text-sm-end" for="syncjobs_max_bps">{{ lang.admin.syncjobs_max_bps|raw }}</label>
<div class="col-sm-8">
<input type="number" class="form-control" id="syncjobs_max_bps" name="max_bps" value="{{ sj_data.max_bps }}" min="0">
</div>
</div>
<button class="btn btn-sm d-block d-sm-inline btn-success" data-action="edit_selected" data-item="self" data-id="syncjob_settings" data-api-url='edit/syncjob_settings' href="#"><i class="bi bi-check-lg"></i> {{ lang.admin.save }}</button>
</form>
</div>