From c85d868c13440afd9b6eda338bdb4f5ebce0119b Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Sun, 8 Sep 2024 23:39:42 -0700 Subject: [PATCH] make polling timeout configurable and 5mins by default (#789) --- skyvern/config.py | 1 + skyvern/constants.py | 2 -- skyvern/webeye/actions/handler.py | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/skyvern/config.py b/skyvern/config.py index c6bf36bc..d2235dd2 100644 --- a/skyvern/config.py +++ b/skyvern/config.py @@ -119,6 +119,7 @@ class Settings(BaseSettings): # TOTP Settings TOTP_LIFESPAN_MINUTES: int = 10 + VERIFICATION_CODE_POLLING_TIMEOUT_MINS: int = 5 def is_cloud_environment(self) -> bool: """ diff --git a/skyvern/constants.py b/skyvern/constants.py index 68e998ed..1ae050df 100644 --- a/skyvern/constants.py +++ b/skyvern/constants.py @@ -13,8 +13,6 @@ BROWSER_CLOSE_TIMEOUT = 180 # 3 minute # reserved fields for navigation payload SPECIAL_FIELD_VERIFICATION_CODE = "verification_code" -VERIFICATION_CODE_POLLING_TIMEOUT_MINS = 10 - class ScrapeType(StrEnum): NORMAL = "normal" diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.py index c95d5c87..f28d5c83 100644 --- a/skyvern/webeye/actions/handler.py +++ b/skyvern/webeye/actions/handler.py @@ -12,7 +12,7 @@ from deprecation import deprecated from playwright.async_api import FileChooser, Locator, Page, TimeoutError from pydantic import BaseModel -from skyvern.constants import REPO_ROOT_DIR, SKYVERN_ID_ATTR, VERIFICATION_CODE_POLLING_TIMEOUT_MINS +from skyvern.constants import REPO_ROOT_DIR, SKYVERN_ID_ATTR from skyvern.exceptions import ( EmptySelect, ErrEmptyTweakValue, @@ -2099,7 +2099,7 @@ async def poll_verification_code( totp_verification_url: str | None = None, totp_identifier: str | None = None, ) -> str | None: - timeout = timedelta(minutes=VERIFICATION_CODE_POLLING_TIMEOUT_MINS) + timeout = timedelta(minutes=SettingsManager.get_settings().VERIFICATION_CODE_POLLING_TIMEOUT_MINS) start_datetime = datetime.utcnow() timeout_datetime = start_datetime + timeout org_token = await app.DATABASE.get_valid_org_auth_token(organization_id, OrganizationAuthTokenType.api)