mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-07-04 21:50:48 +08:00
fix(scanner): fail-fast skip on GitHub rate limit (plain urllib3 Retry)
Replace PyGithub's default GithubRetry (which sleeps until rate-limit reset and retries up to 10x) with a plain urllib3 Retry. A rate-limit 403/429 is no longer in status_forcelist, so it raises RateLimitExceededException immediately; renew_stat's except-block catches it and skips. Transient 5xx errors remain retried (D2). [#1-sub-2]
This commit is contained in:
parent
c352b16bb1
commit
dba1b7742b
10
scanner.py
10
scanner.py
@ -17,6 +17,7 @@ builtin_nodes = set()
|
||||
import sys
|
||||
|
||||
from urllib.parse import urlparse
|
||||
from urllib3.util.retry import Retry
|
||||
from github import Github, Auth
|
||||
from pathlib import Path
|
||||
from typing import Set, Dict, Optional
|
||||
@ -1619,7 +1620,14 @@ if __name__ == "__main__":
|
||||
|
||||
if not skip_stat_update:
|
||||
auth = Auth.Token(os.environ.get('GITHUB_TOKEN'))
|
||||
g = Github(auth=auth)
|
||||
# Use a plain urllib3 Retry (NOT PyGithub's default GithubRetry) so that
|
||||
# a GitHub rate-limit response (403/429) raises RateLimitExceededException
|
||||
# IMMEDIATELY instead of sleeping until the rate-limit reset and retrying
|
||||
# up to 10x. The except-block in renew_stat() then catches it and skips
|
||||
# (returns None). 403/429 are intentionally NOT in status_forcelist, so
|
||||
# they fail fast; only transient 5xx errors are retried.
|
||||
g = Github(auth=auth, retry=Retry(total=2, backoff_factor=0.5,
|
||||
status_forcelist=[500, 502, 503, 504]))
|
||||
else:
|
||||
g = None
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user