Keep upload speed limits at the configured decimal MB/s
CI / verify (push) Canceled after 0s

The shared upload limiter started with a full second of tokens and refilled
up to one second during short idle gaps, so new uploads could briefly send
almost twice the limit. In a parallel-upload test it released 3.87 MB in one
second at a 2 MB/s limit. Uploads now reserve send time on one shared
schedule with at most a 200 ms burst and exact waits.

Speeds and limits used 1024-based kB and MB while being shown as kB/s and
MB/s, so a limit of 100 meant 104.9 MB/s. Limits, measured speeds, ETA and
the speed graph now use 1 MB = 1,000,000 bytes. Saved limits are converted
once so the displayed value stays the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SucukdeluxeandClaude Opus 5.5 committed 2026-10-21 00:26:01 +02:00
1 parent 290b9db8ce
commit d37e86690f
5 files changed
+60 -54

No files matched your search

+8 -1
View File
@@ -83,6 +83,7 @@ const DEFAULTS = {
deleteSourceAfterSuccessfulUpload: false,
showDropTarget: false,
globalMaxSpeedKbs: 0, // 0 = unlimited global speed
speedUnits: 'decimal',
pendingQueue: null,
uploadRecovery: null,
scramble: {
@@ -420,6 +421,9 @@ class ConfigStore {
}
}
const savedGlobal = data.globalSettings || {};
const binarySpeeds = savedGlobal.speedUnits !== 'decimal';
const toDecimalKbs = (value) => binarySpeeds && Number(value) > 0 ? Math.round(Number(value) * 1000 / 1024) : value;
// Merge hoster settings with defaults
const hosterSettings = {};
for (const name of Object.keys(DEFAULTS.hosterSettings)) {
@@ -427,12 +431,15 @@ class ConfigStore {
...HOSTER_SETTINGS_DEFAULTS,
...(data.hosterSettings && data.hosterSettings[name] || {})
};
hosterSettings[name].maxSpeedKbs = toDecimalKbs(hosterSettings[name].maxSpeedKbs);
hosterSettings[name].restartBelowKbs = toDecimalKbs(hosterSettings[name].restartBelowKbs);
}
const savedGlobal = data.globalSettings || {};
const globalSettings = {
...DEFAULTS.globalSettings,
...savedGlobal
};
globalSettings.globalMaxSpeedKbs = toDecimalKbs(globalSettings.globalMaxSpeedKbs);
globalSettings.speedUnits = 'decimal';
delete globalSettings.allowPlaintextCredentialStorage;
// Deep-merge nested objects so new keys are always present
for (const key of Object.keys(DEFAULTS.globalSettings)) {