refactor(timeouts): make BROWSER_SUBMIT_NAV_TIMEOUT a per-platform defaultdict
This commit is contained in:
parent
789cb3205b
commit
0082ecc9f4
3 changed files with 7 additions and 3 deletions
|
|
@ -33,6 +33,7 @@ from .timeouts import (
|
|||
BROWSER_NAV_TIMEOUT,
|
||||
BROWSER_SESSION_TIMEOUT,
|
||||
BROWSER_SETTLE_DELAY,
|
||||
BROWSER_SUBMIT_NAV_TIMEOUT,
|
||||
BROWSER_TURNSTILE_POLL,
|
||||
HTTP_TIMEOUT,
|
||||
)
|
||||
|
|
@ -361,7 +362,7 @@ def _submit_headless(
|
|||
page.wait_for_timeout(BROWSER_SETTLE_DELAY)
|
||||
page.locator('button[type="submit"]').click()
|
||||
page.wait_for_url(
|
||||
lambda url: "/submissions/me" in url, timeout=BROWSER_NAV_TIMEOUT
|
||||
lambda url: "/submissions/me" in url, timeout=BROWSER_SUBMIT_NAV_TIMEOUT["atcoder"]
|
||||
)
|
||||
except Exception as e:
|
||||
submit_error = str(e)
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ def _submit_headless(
|
|||
try:
|
||||
page.wait_for_url(
|
||||
lambda url: "/my" in url or "/status" in url,
|
||||
timeout=BROWSER_SUBMIT_NAV_TIMEOUT,
|
||||
timeout=BROWSER_SUBMIT_NAV_TIMEOUT["codeforces"],
|
||||
)
|
||||
except Exception:
|
||||
err_el = page.query_selector("span.error")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
from collections import defaultdict
|
||||
|
||||
HTTP_TIMEOUT = 15.0
|
||||
|
||||
BROWSER_SESSION_TIMEOUT = 15000
|
||||
BROWSER_NAV_TIMEOUT = 10000
|
||||
BROWSER_SUBMIT_NAV_TIMEOUT = BROWSER_NAV_TIMEOUT * 2
|
||||
BROWSER_SUBMIT_NAV_TIMEOUT: defaultdict[str, int] = defaultdict(lambda: BROWSER_NAV_TIMEOUT)
|
||||
BROWSER_SUBMIT_NAV_TIMEOUT["codeforces"] = BROWSER_NAV_TIMEOUT * 2
|
||||
BROWSER_TURNSTILE_POLL = 5000
|
||||
BROWSER_ELEMENT_WAIT = 10000
|
||||
BROWSER_SETTLE_DELAY = 500
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue