Double Bitwarden call timeout for each retry (#896)
This commit is contained in:
@@ -82,13 +82,14 @@ class BitwardenService:
|
|||||||
url: str,
|
url: str,
|
||||||
collection_id: str | None = None,
|
collection_id: str | None = None,
|
||||||
remaining_retries: int = settings.BITWARDEN_MAX_RETRIES,
|
remaining_retries: int = settings.BITWARDEN_MAX_RETRIES,
|
||||||
|
timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS,
|
||||||
fail_reasons: list[str] = [],
|
fail_reasons: list[str] = [],
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
"""
|
"""
|
||||||
Get the secret value from the Bitwarden CLI.
|
Get the secret value from the Bitwarden CLI.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS):
|
async with asyncio.timeout(timeout):
|
||||||
return await BitwardenService._get_secret_value_from_url(
|
return await BitwardenService._get_secret_value_from_url(
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
client_secret=client_secret,
|
client_secret=client_secret,
|
||||||
@@ -111,6 +112,8 @@ class BitwardenService:
|
|||||||
url=url,
|
url=url,
|
||||||
collection_id=collection_id,
|
collection_id=collection_id,
|
||||||
remaining_retries=remaining_retries,
|
remaining_retries=remaining_retries,
|
||||||
|
# Double the timeout for the next retry
|
||||||
|
timeout=timeout * 2,
|
||||||
fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"],
|
fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -207,13 +210,14 @@ class BitwardenService:
|
|||||||
identity_key: str,
|
identity_key: str,
|
||||||
identity_fields: list[str],
|
identity_fields: list[str],
|
||||||
remaining_retries: int = settings.BITWARDEN_MAX_RETRIES,
|
remaining_retries: int = settings.BITWARDEN_MAX_RETRIES,
|
||||||
|
timeout: int = settings.BITWARDEN_TIMEOUT_SECONDS,
|
||||||
fail_reasons: list[str] = [],
|
fail_reasons: list[str] = [],
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
"""
|
"""
|
||||||
Get the secret value from the Bitwarden CLI.
|
Get the secret value from the Bitwarden CLI.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
async with asyncio.timeout(settings.BITWARDEN_TIMEOUT_SECONDS):
|
async with asyncio.timeout(timeout):
|
||||||
return await BitwardenService._get_sensitive_information_from_identity(
|
return await BitwardenService._get_sensitive_information_from_identity(
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
client_secret=client_secret,
|
client_secret=client_secret,
|
||||||
@@ -238,6 +242,8 @@ class BitwardenService:
|
|||||||
identity_key=identity_key,
|
identity_key=identity_key,
|
||||||
identity_fields=identity_fields,
|
identity_fields=identity_fields,
|
||||||
remaining_retries=remaining_retries,
|
remaining_retries=remaining_retries,
|
||||||
|
# Double the timeout for the next retry
|
||||||
|
timeout=timeout * 2,
|
||||||
fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"],
|
fail_reasons=fail_reasons + [f"{type(e).__name__}: {str(e)}"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user