api/base: retry RemoteProtocolError and ReadError
Both surface when an overloaded booru drops the TCP connection after sending headers but before the body completes. The existing retry tuple (TimeoutException, ConnectError, NetworkError) missed these even though they're the same shape of transient server-side failure. Keeps the existing single-retry-at-1s cadence; no retry-count bump in this pass.
This commit is contained in:
parent
ab44735f28
commit
9ec034f7ef
@ -12,6 +12,7 @@
|
|||||||
- `category_fetcher._do_ensure` no longer permanently flips `_batch_api_works` to False when a transient network error drops a tag-API request mid-call; the unprobed path now routes through `_probe_batch_api`, which distinguishes clean 200-with-zero-matches (structurally broken, flip) from timeout/HTTP-error (transient, retry next call)
|
- `category_fetcher._do_ensure` no longer permanently flips `_batch_api_works` to False when a transient network error drops a tag-API request mid-call; the unprobed path now routes through `_probe_batch_api`, which distinguishes clean 200-with-zero-matches (structurally broken, flip) from timeout/HTTP-error (transient, retry next call)
|
||||||
- Bookmark→library save and bookmark Save As now plumb the active site's `CategoryFetcher` through to the filename template, so `%artist%`/`%character%` tokens render correctly instead of silently dropping out when saving a post that wasn't previewed first
|
- Bookmark→library save and bookmark Save As now plumb the active site's `CategoryFetcher` through to the filename template, so `%artist%`/`%character%` tokens render correctly instead of silently dropping out when saving a post that wasn't previewed first
|
||||||
- Info panel no longer silently drops tags that failed to land in a cached category — any tag from `post.tag_list` not rendered under a known category section now appears in an "Other" bucket, so partial cache coverage can't make individual tags invisible
|
- Info panel no longer silently drops tags that failed to land in a cached category — any tag from `post.tag_list` not rendered under a known category section now appears in an "Other" bucket, so partial cache coverage can't make individual tags invisible
|
||||||
|
- `BooruClient._request` retries now cover `httpx.RemoteProtocolError` and `httpx.ReadError` in addition to the existing timeout/connect/network set — an overloaded booru that drops the TCP connection mid-response no longer fails the whole search on the first try
|
||||||
|
|
||||||
### Refactored
|
### Refactored
|
||||||
- `category_fetcher` batch tag-API params are now built by a shared `_build_tag_api_params` helper instead of duplicated across `fetch_via_tag_api` and `_probe_batch_api`
|
- `category_fetcher` batch tag-API params are now built by a shared `_build_tag_api_params` helper instead of duplicated across `fetch_via_tag_api` and `_probe_batch_api`
|
||||||
|
|||||||
@ -152,9 +152,18 @@ class BooruClient(ABC):
|
|||||||
wait = 2.0
|
wait = 2.0
|
||||||
log.info(f"Retrying {url} after {resp.status_code} (wait {wait}s)")
|
log.info(f"Retrying {url} after {resp.status_code} (wait {wait}s)")
|
||||||
await asyncio.sleep(wait)
|
await asyncio.sleep(wait)
|
||||||
except (httpx.TimeoutException, httpx.ConnectError, httpx.NetworkError) as e:
|
except (
|
||||||
# Retry on transient DNS/TCP/timeout failures. Without this,
|
httpx.TimeoutException,
|
||||||
# a single DNS hiccup or RST blows up the whole search.
|
httpx.ConnectError,
|
||||||
|
httpx.NetworkError,
|
||||||
|
httpx.RemoteProtocolError,
|
||||||
|
httpx.ReadError,
|
||||||
|
) as e:
|
||||||
|
# Retry on transient DNS/TCP/timeout failures plus
|
||||||
|
# mid-response drops — RemoteProtocolError and ReadError
|
||||||
|
# are common when an overloaded booru closes the TCP
|
||||||
|
# connection between headers and body. Without them a
|
||||||
|
# single dropped response blows up the whole search.
|
||||||
if attempt == 1:
|
if attempt == 1:
|
||||||
raise
|
raise
|
||||||
log.info(f"Retrying {url} after {type(e).__name__}: {e}")
|
log.info(f"Retrying {url} after {type(e).__name__}: {e}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user