Apply the connection-count setting live, without a payload restart

The pool now spawns the full worker set at startup and gates each worker by
its slot against a live active_conns limit, instead of spawning exactly
max_connections threads once. Saving a new value in Settings updates the
limit and broadcasts: idle workers wake to pull pieces, and a lowered limit
parks the extra workers after they finish their current piece. No restart,
and no thread creation/teardown at runtime.

Verified on device: max_connections changed 4 -> 8 -> 16 -> 4 through the API
while a download stayed active throughout. (Throughput did not scale with
connections on this CDN, which caps aggregate bandwidth per source IP; 4 is a
sensible default.)
This commit is contained in:
Knutwurst committed 2026-06-24 11:36:48 +02:00
1 parent 21f6bd61ad
commit 6024dbfc5d
2 files changed
+50 -11

No files matched your search

+1 -1
View File
@@ -189,7 +189,7 @@
<label class="field">
<span>Parallel download connections</span>
<input id="maxConnections" type="number" min="1" max="16" step="1"
title="Connections used to download a patch in parallel — applies after a restart" />
title="Connections used to download a patch in parallel — applies live on Save (raising is instant; lowering settles as in-flight pieces finish)" />
</label>
</div>