mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 01:55:10 -07:00
[PictureLoader] Let unlocked hosts skip dispatch pacing; adjust limits per URL
Two refinements to the per-host request caps: - Unlocked hosts (UNLIMITED_HOST_QUOTA, e.g. cards.scryfall.io) no longer wait on the 100ms dispatch pacing or consume the global per-second quota. dispatchQueuedRequest fires their queued requests back-to-back, bounded only by their 429 backoff window and Qt's per-host connection pool, so an unthrottled CDN is not artificially slowed. - The deck editor download settings page replaces the static grid of one spinbox per known host with an "Adjust Rate Limit" toolbar action on the URL list. It picks the host out of the selected URL and clamps the entry against the developer cap table (including for user-added URLs). Also fixes a review finding: resetRequestQuota could write the UNLIMITED_HOST_QUOTA sentinel (-1) into the sustained per-host quota when a host became unlocked mid-run, permanently poisoning its allowance. Stale entries for unlocked hosts are now dropped, and the per-second seed is clamped against the effective ceiling so a lowered limit applies immediately.
This commit is contained in:
parent
da307a82b3
commit
7b82ca08da
5 changed files with 91 additions and 91 deletions
|
|
@ -12,7 +12,7 @@ const QStringList DownloadSettings::DEFAULT_DOWNLOAD_URLS = {
|
|||
// Developer-set ceilings for the per-host request allowance. Users may lower a host's
|
||||
// allowance via the download settings, but can never raise it above these values. Hosts
|
||||
// not listed default to DEFAULT_HOST_REQUEST_LIMIT. A cap of UNLIMITED_HOST_QUOTA marks a
|
||||
// host that is never throttled per host (request pacing and 429 backoff still apply).
|
||||
// host that is never throttled per host and skips the dispatch pacing (429 backoff still applies).
|
||||
const QHash<QString, int> DownloadSettings::DEVELOPER_HOST_CAPS = {
|
||||
// The Scryfall API enforces 10 requests/second; stay one under so a burst can't trip 429s.
|
||||
{"api.scryfall.com", 9},
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
static constexpr int DEFAULT_HOST_REQUEST_LIMIT = 10;
|
||||
/** @brief Floor for any per-host request allowance. */
|
||||
static constexpr int MIN_HOST_REQUEST_LIMIT = 1;
|
||||
/** @brief Developer cap marking a host as never throttled per host (pacing still applies). */
|
||||
/** @brief Developer cap marking a host as never throttled per host or by the dispatch pacing. */
|
||||
static constexpr int UNLIMITED_HOST_QUOTA = -1;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue