mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-17 08:28:13 +00:00
feat(download): a concurrency limit per source (#1495)
With one global limit, a few tasks that are only waiting hold every slot. A Soulseek download sitting in a peer's queue is the example I hit: three of those and a torrent that could start waits behind them. `MAX_CONCURRENT_DOWNLOADS_PER_SOURCE` (0 keeps the single global limit, which is the default). With it set, the coordinator starts a download only when its source is below the limit and passes over tasks of a full source without losing their place in the queue. `get_next` gets an optional filter for this, and a cancelled task is still dropped when one is given. The start-up stagger now applies only between downloads from the same source, and the pool is sized so every source can reach its limit. The second commit: qBittorrent keeps its own queue of torrents waiting for a free slot. The task polling one of those does no work, so it no longer counts against its source's limit and the next task of that source can start. The client does the pacing, as it does for its own queue. Tests cover the queue pass-over (order and priority kept, nothing eligible, cancelled tasks), the coordinator (a full source doesn't block the others, each source has its own limit, the global limit when unset) and the client-queue case. Ruff and the backend suite pass.
This commit is contained in:
1 parent
e8297c94a9
commit
06a67a7150
9 files changed
+335
-18
No files matched your search
@@ -542,6 +542,7 @@ Audiobooks only. AudiobookBay lists it for most releases. In Prowlarr results it
|
||||
| `AUTO_OPEN_DOWNLOADS_SIDEBAR` | Automatically open the downloads sidebar when a new download is queued. | boolean | `false` |
|
||||
| `DOWNLOAD_TO_BROWSER_CONTENT_TYPES` | Automatically download completed files to your browser for the selected content types. | string (comma-separated) | _empty list_ |
|
||||
| `MAX_CONCURRENT_DOWNLOADS` | Maximum number of simultaneous downloads. | number | `3` |
|
||||
| `MAX_CONCURRENT_DOWNLOADS_PER_SOURCE` | Simultaneous downloads allowed from each source (Soulseek, AudiobookBay, Direct Download and so on). A source at its limit does not hold the others back, so a Soulseek download waiting in a peer's queue cannot stop a torrent from starting. 0 uses the single limit above for all sources together. | number | `0` |
|
||||
| `STATUS_TIMEOUT` | How long to keep completed/failed downloads in the queue display. | number | `3600` |
|
||||
|
||||
<details>
|
||||
@@ -852,6 +853,17 @@ Maximum number of simultaneous downloads.
|
||||
- **Requires restart:** Yes
|
||||
- **Constraints:** min: 1, max: 10
|
||||
|
||||
#### `MAX_CONCURRENT_DOWNLOADS_PER_SOURCE`
|
||||
|
||||
**Max Concurrent Downloads Per Source**
|
||||
|
||||
Simultaneous downloads allowed from each source (Soulseek, AudiobookBay, Direct Download and so on). A source at its limit does not hold the others back, so a Soulseek download waiting in a peer's queue cannot stop a torrent from starting. 0 uses the single limit above for all sources together.
|
||||
|
||||
- **Type:** number
|
||||
- **Default:** `0`
|
||||
- **Requires restart:** Yes
|
||||
- **Constraints:** min: 0, max: 10
|
||||
|
||||
#### `STATUS_TIMEOUT`
|
||||
|
||||
**Status Timeout (seconds)**
|
||||
|
||||
Reference in new issue
Block a user