make totp code fetch more reliable (#809)
This commit is contained in:
@@ -119,6 +119,7 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
# TOTP Settings
|
# TOTP Settings
|
||||||
TOTP_LIFESPAN_MINUTES: int = 10
|
TOTP_LIFESPAN_MINUTES: int = 10
|
||||||
|
VERIFICATION_CODE_INITIAL_WAIT_TIME_SECS: int = 40
|
||||||
VERIFICATION_CODE_POLLING_TIMEOUT_MINS: int = 5
|
VERIFICATION_CODE_POLLING_TIMEOUT_MINS: int = 5
|
||||||
|
|
||||||
def is_cloud_environment(self) -> bool:
|
def is_cloud_environment(self) -> bool:
|
||||||
|
|||||||
@@ -1617,7 +1617,7 @@ class ForgeAgent:
|
|||||||
browser_state,
|
browser_state,
|
||||||
element_tree_in_prompt,
|
element_tree_in_prompt,
|
||||||
verification_code_check=False,
|
verification_code_check=False,
|
||||||
expire_verification_code=False,
|
expire_verification_code=True,
|
||||||
)
|
)
|
||||||
return await app.LLM_API_HANDLER(
|
return await app.LLM_API_HANDLER(
|
||||||
prompt=extract_action_prompt,
|
prompt=extract_action_prompt,
|
||||||
|
|||||||
@@ -2118,6 +2118,8 @@ async def poll_verification_code(
|
|||||||
if not org_token:
|
if not org_token:
|
||||||
LOG.error("Failed to get organization token when trying to get verification code")
|
LOG.error("Failed to get organization token when trying to get verification code")
|
||||||
return None
|
return None
|
||||||
|
# wait for 40 seconds to let the verification code comes in before polling
|
||||||
|
await asyncio.sleep(SettingsManager.get_settings().VERIFICATION_CODE_INITIAL_WAIT_TIME_SECS)
|
||||||
while True:
|
while True:
|
||||||
# check timeout
|
# check timeout
|
||||||
if datetime.utcnow() > timeout_datetime:
|
if datetime.utcnow() > timeout_datetime:
|
||||||
|
|||||||
Reference in New Issue
Block a user