Skip to content

Commit

Permalink
make polling timeout configurable and 5mins by default (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Sep 9, 2024
1 parent 1dbdef9 commit c85d868
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions skyvern/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
2 changes: 0 additions & 2 deletions skyvern/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# reserved fields for navigation payload
SPECIAL_FIELD_VERIFICATION_CODE = "verification_code"

VERIFICATION_CODE_POLLING_TIMEOUT_MINS = 10


class ScrapeType(StrEnum):
NORMAL = "normal"
Expand Down
4 changes: 2 additions & 2 deletions skyvern/webeye/actions/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c85d868

Please sign in to comment.