new poll
This commit is contained in:
parent
2d40ae0d63
commit
d65e888ade
|
|
@ -58,12 +58,11 @@ from app.core.time import utcnow
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
CACHE_TTL_SECONDS = 60
|
CACHE_TTL_SECONDS = 60
|
||||||
# Anthropic's subscription endpoint rate-limit window is ~30-60s. Retrying
|
# Anthropic's oauth/usage endpoint requires User-Agent: claude-code/<ver> and
|
||||||
# sooner than that (old 5s value) creates a tight retry loop that keeps the
|
# enforces a ~180s poll floor — callers without the correct UA hit an aggressive
|
||||||
# rate limit permanently throttled. Use the same 60s TTL as successes so the
|
# bucket that 429s indefinitely. Keep the failure TTL at 180s so we never
|
||||||
# next auto-poll only fires after the window has cleared. Manual refreshes
|
# retry faster than that floor. Manual refreshes (force_refresh=True) bypass.
|
||||||
# (force_refresh=True) always bypass this TTL.
|
CACHE_TTL_FAILURE_SECONDS = 180
|
||||||
CACHE_TTL_FAILURE_SECONDS = 60
|
|
||||||
STALE_SUBSCRIPTION_TTL_SECONDS = 10 * 60
|
STALE_SUBSCRIPTION_TTL_SECONDS = 10 * 60
|
||||||
REQUEST_TIMEOUT = 8.0 # seconds
|
REQUEST_TIMEOUT = 8.0 # seconds
|
||||||
|
|
||||||
|
|
@ -768,7 +767,7 @@ async def _fetch_anthropic_subscription(session_key: str) -> list[SubscriptionWi
|
||||||
"""
|
"""
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": f"Bearer {session_key}",
|
"Authorization": f"Bearer {session_key}",
|
||||||
"User-Agent": "pipeline",
|
"User-Agent": "claude-code/1.0.0",
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
"anthropic-version": "2023-06-01",
|
"anthropic-version": "2023-06-01",
|
||||||
"anthropic-beta": "oauth-2025-04-20",
|
"anthropic-beta": "oauth-2025-04-20",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue