From 44627df9da0ac1d651e2d584b281305492b0ab9a Mon Sep 17 00:00:00 2001 From: Kerem Yilmaz Date: Wed, 2 Oct 2024 11:05:29 -0700 Subject: [PATCH] Double Bitwarden call timeout for each retry (#896) --- skyvern/forge/sdk/services/bitwarden.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/skyvern/forge/sdk/services/bitwarden.py b/skyvern/forge/sdk/services/bitwarden.py index 6d8fcfbf..c7d05cea 100644 --- a/skyvern/forge/sdk/services/bitwarden.py +++ b/skyvern/forge/sdk/services/bitwarden.py @@ -82,13 +82,14 @@ class BitwardenService: url: str, collection_id: str | None = None, remaining_retries: int = settings.BITWARDEN_MAX_RETRIES, + timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS, fail_reasons: list[str] = [], ) -> dict[str, str]: """ Get the secret value from the Bitwarden CLI. """ try: - async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS): + async with asyncio.timeout(timeout): return await BitwardenService._get_secret_value_from_url( client_id=client_id, client_secret=client_secret, @@ -111,6 +112,8 @@ class BitwardenService: url=url, collection_id=collection_id, remaining_retries=remaining_retries, + # Double the timeout for the next retry + timeout=timeout * 2, fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"], ) @@ -207,13 +210,14 @@ class BitwardenService: identity_key: str, identity_fields: list[str], remaining_retries: int = settings.BITWARDEN_MAX_RETRIES, + timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS, fail_reasons: list[str] = [], ) -> dict[str, str]: """ Get the secret value from the Bitwarden CLI. """ try: - async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS): + async with asyncio.timeout(timeout): return await BitwardenService._get_sensitive_information_from_identity( client_id=client_id, client_secret=client_secret, @@ -238,6 +242,8 @@ class BitwardenService: identity_key=identity_key, identity_fields=identity_fields, remaining_retries=remaining_retries, + # Double the timeout for the next retry + timeout=timeout * 2, fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"], )