style: trim the HLTB comments down to the non-obvious why

Drop a comment that restated the constant it sat above, and cut the clauses
that defended the approach against the one it replaced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Georges-Antoine Assi
2026-08-29 08:36:38 -04:00
parent 2a7953ed58
commit 2a9f7251fd
3 changed files with 5 additions and 8 deletions

View File

@@ -42,7 +42,6 @@ HLTB_MAX_REQUESTS_PER_SECOND: Final[float] = 3
# One attempt, plus one for a renewed session and one for a rate-limit backoff.
HLTB_MAX_REQUEST_ATTEMPTS: Final[int] = 3
HLTB_RATE_LIMIT_BACKOFF_SECONDS: Final[float] = 2
# How long a failed session mint is left alone before another lookup retries it.
HLTB_SESSION_RETRY_SECONDS: Final[float] = 60
_rate_limiter = RateLimiter(HLTB_MAX_REQUESTS_PER_SECOND)
@@ -330,8 +329,8 @@ class HLTBHandler(MetadataHandler):
if self._has_session():
return True
# A mint that just failed means HLTB is down or blocking this host, so
# every remaining ROM in a scan should not pay for its own round trip.
# A mint that just failed means HLTB is down or blocking this host,
# so every ROM left in a scan must not pay for its own round trip.
now = time.monotonic()
if now < self._session_retry_after:
return False

View File

@@ -1,5 +1,5 @@
"""The HowLongToBeat search wire contract, shared by the handler and the endpoint
discovery script so the script validates a route against what the handler sends."""
discovery script."""
from typing import Final, NamedTuple

View File

@@ -22,8 +22,7 @@ from utils.hltb_search import (
search_headers,
)
# Next.js lists every route it serves as a plain literal in _buildManifest.js, so
# discovery does not depend on how the app bundle is built or minified.
# Next.js lists every route it serves as a plain literal in _buildManifest.js.
BUILD_MANIFEST_REGEX = re.compile(
r'src=["\'](?P<path>[^"\']*/_next/static/[^"\']+/_buildManifest\.js)["\']'
)
@@ -102,8 +101,7 @@ def _rejection_reason(
except (httpx.RequestError, httpx.HTTPStatusError, ValueError) as e:
return str(e)
# The same shape search_games() reads, so a wrong route cannot pass by
# returning some other 200.
# The same shape search_games() reads.
if not isinstance(results, list) or not results:
return "search returned no results"