Raise proxy connection limit to 40
This commit is contained in:
@@ -109,7 +109,7 @@ export function defaultSettings(): AppSettings {
|
||||
proxyDownloadEnabled: false,
|
||||
proxyListPath: "",
|
||||
proxyApiProxyIndex: 1,
|
||||
proxyConnectionsPerDownload: 20,
|
||||
proxyConnectionsPerDownload: 32,
|
||||
updateRepo: DEFAULT_UPDATE_REPO,
|
||||
autoUpdateCheck: true,
|
||||
clipboardWatch: false,
|
||||
|
||||
@@ -12,6 +12,8 @@ const DEFAULT_MIN_SEGMENT_BYTES = 8 * 1024 * 1024;
|
||||
const DEFAULT_MAX_CHUNK_BYTES = 16 * 1024 * 1024;
|
||||
const DEFAULT_CHUNKS_PER_CONNECTION = 8;
|
||||
const DEFAULT_PROXY_ATTEMPTS = 3;
|
||||
const DEFAULT_CONNECTION_LIMIT = 32;
|
||||
const MAX_CONNECTION_LIMIT = 40;
|
||||
const PROXY_PROBE_END = 1;
|
||||
const MAX_REDIRECTS = 5;
|
||||
const MAX_SEGMENTS = 4_096;
|
||||
@@ -86,6 +88,11 @@ export type ProxyFallbackReason =
|
||||
|
||||
const proxyFileCache = new Map<string, CachedProxyFile>();
|
||||
|
||||
export function normalizeProxyConnectionLimit(value: number, fallback = DEFAULT_CONNECTION_LIMIT): number {
|
||||
const candidate = Number.isFinite(value) && value !== 0 ? value : fallback;
|
||||
return Math.max(2, Math.min(MAX_CONNECTION_LIMIT, Math.floor(candidate)));
|
||||
}
|
||||
|
||||
function proxyEndpointKey(proxy: ProxyEndpoint): string {
|
||||
return `${proxy.url}\0${proxy.authorization}`;
|
||||
}
|
||||
@@ -124,8 +131,8 @@ interface ProxyPerformance {
|
||||
}
|
||||
|
||||
class SharedProxyCoordinator {
|
||||
private configuredConnectionLimit = 16;
|
||||
private adaptiveConnectionLimit = 16;
|
||||
private configuredConnectionLimit = DEFAULT_CONNECTION_LIMIT;
|
||||
private adaptiveConnectionLimit = DEFAULT_CONNECTION_LIMIT;
|
||||
private activeConnections = 0;
|
||||
private readonly activeProxies = new Set<string>();
|
||||
private readonly activeConnectionsByGroup = new Map<string, number>();
|
||||
@@ -139,7 +146,7 @@ class SharedProxyCoordinator {
|
||||
private successfulTransfersSinceThrottle = 0;
|
||||
|
||||
public setConnectionLimit(limit: number): void {
|
||||
const normalized = Math.max(2, Math.min(32, Math.floor(limit || 16)));
|
||||
const normalized = normalizeProxyConnectionLimit(limit);
|
||||
if (normalized !== this.configuredConnectionLimit) {
|
||||
this.configuredConnectionLimit = normalized;
|
||||
this.adaptiveConnectionLimit = normalized;
|
||||
@@ -842,8 +849,8 @@ export async function downloadWithProxySegments(options: ProxySegmentedDownloadO
|
||||
return { status: "fallback", reason: "no_valid_proxies" };
|
||||
}
|
||||
const poolKey = path.resolve(proxyPath);
|
||||
const requestedConnections = Math.max(2, Math.min(32, Math.floor(options.connections || 16)));
|
||||
const totalConnectionLimit = Math.max(2, Math.min(32, Math.floor(options.totalConnectionLimit ?? requestedConnections)));
|
||||
const requestedConnections = normalizeProxyConnectionLimit(options.connections);
|
||||
const totalConnectionLimit = normalizeProxyConnectionLimit(options.totalConnectionLimit ?? requestedConnections, requestedConnections);
|
||||
sharedProxyCoordinator.setConnectionLimit(totalConnectionLimit);
|
||||
const reservedProxyIndex = Math.max(0, Math.floor(options.reservedProxyIndex || 0));
|
||||
const reservedProxy = reservedProxyIndex > 0 ? loaded.proxies[reservedProxyIndex - 1] : null;
|
||||
|
||||
+1
-1
@@ -615,7 +615,7 @@ export function normalizeSettings(settings: AppSettings): AppSettings {
|
||||
proxyDownloadEnabled: Boolean(settings.proxyDownloadEnabled),
|
||||
proxyListPath: asText(settings.proxyListPath).slice(0, 4096),
|
||||
proxyApiProxyIndex: clampNumber(settings.proxyApiProxyIndex, defaults.proxyApiProxyIndex, 1, 100000),
|
||||
proxyConnectionsPerDownload: clampNumber(settings.proxyConnectionsPerDownload, defaults.proxyConnectionsPerDownload, 2, 32),
|
||||
proxyConnectionsPerDownload: clampNumber(settings.proxyConnectionsPerDownload, defaults.proxyConnectionsPerDownload, 2, 40),
|
||||
autoUpdateCheck: Boolean(settings.autoUpdateCheck),
|
||||
updateRepo: migrateUpdateRepo(asText(settings.updateRepo), defaults.updateRepo),
|
||||
clipboardWatch: Boolean(settings.clipboardWatch),
|
||||
|
||||
@@ -953,7 +953,7 @@ const emptySnapshot = (): UiSnapshot => ({
|
||||
removeSamplesAfterExtract: false, enableIntegrityCheck: true, autoResumeOnStart: true,
|
||||
autoReconnect: false, reconnectWaitSeconds: 45, completedCleanupPolicy: "never",
|
||||
maxParallel: 4, maxParallelExtract: 2, extractCpuPriority: "high", retryLimit: 0, speedLimitEnabled: false, speedLimitKbps: 0, speedLimitMode: "global",
|
||||
proxyDownloadEnabled: false, proxyListPath: "", proxyApiProxyIndex: 1, proxyConnectionsPerDownload: 20,
|
||||
proxyDownloadEnabled: false, proxyListPath: "", proxyApiProxyIndex: 1, proxyConnectionsPerDownload: 32,
|
||||
updateRepo: "", autoUpdateCheck: true, clipboardWatch: false, minimizeToTray: false,
|
||||
theme: "dark", themePreference: "dark", logStorageLocation: "appdata", collapseNewPackages: true, animatePackageDisclosure: true, historyRetentionMode: "permanent", historyMaxEntries: 500, historyMaxAgeDays: 0, autoSortPackagesByProgress: false, autoSkipExtracted: false, hideExtractedItems: true, confirmDeleteSelection: true, backupIncludeDownloads: false, backupIncludeRemoteDiagnostics: false,
|
||||
notifyMention: "", notifyOnPackageCompleted: false, notifyOnPackageFailed: false, notifyOnRunFinished: false,
|
||||
@@ -6067,7 +6067,7 @@ export function App(): ReactElement {
|
||||
maxParallelExtract: [1, 8, 2],
|
||||
reconnectWaitSeconds: [10, 600, 45],
|
||||
proxyApiProxyIndex: [1, 100000, 1],
|
||||
proxyConnectionsPerDownload: [2, 32, 20]
|
||||
proxyConnectionsPerDownload: [2, 40, 32]
|
||||
};
|
||||
const bounds = numericLimits[fieldId as keyof RendererSettingsDraft];
|
||||
if (bounds) {
|
||||
|
||||
@@ -460,9 +460,9 @@ export function buildSettingsFormViewModel({
|
||||
label: "Proxy-Verbindungen insgesamt",
|
||||
value: String(settings.proxyConnectionsPerDownload),
|
||||
min: 2,
|
||||
max: 32,
|
||||
max: 40,
|
||||
disabled: !settings.proxyDownloadEnabled,
|
||||
help: `Dieses Gesamtlimit wird fair zwischen allen gleichzeitigen Segmentdownloads geteilt. Bei ${settings.maxParallel} aktiven Downloads laufen zusammen höchstens ${settings.proxyConnectionsPerDownload} Segmentverbindungen; 20 ist der empfohlene Startwert. Langsame und ausgefallene Proxys werden automatisch zurückgestuft. Kleine Dateien, Teil-Downloads und aktive Geschwindigkeitslimits laufen über den festen API-Proxy.`
|
||||
help: `Dieses Gesamtlimit wird fair zwischen allen gleichzeitigen Segmentdownloads geteilt. Bei ${settings.maxParallel} aktiven Downloads laufen zusammen höchstens ${settings.proxyConnectionsPerDownload} Segmentverbindungen; 32 ist der Standardwert, 40 das Maximum. Langsame und ausgefallene Proxys werden automatisch zurückgestuft. Kleine Dateien, Teil-Downloads und aktive Geschwindigkeitslimits laufen über den festen API-Proxy.`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user