feat: update timeout
This commit is contained in:
@@ -18,7 +18,7 @@ class BeorgService(IBeorgService):
|
||||
machine_uid: str,
|
||||
token: str,
|
||||
process_info: list[dict[str,Any]],
|
||||
timeout: int = 15,
|
||||
timeout: int = 120,
|
||||
) -> None:
|
||||
self._project_id = project_id
|
||||
self._machine_uid = machine_uid
|
||||
@@ -38,6 +38,7 @@ class BeorgService(IBeorgService):
|
||||
}
|
||||
|
||||
timeout = aiohttp.ClientTimeout(total=self._timeout)
|
||||
try:
|
||||
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||
async with session.post(
|
||||
f'{self.BASE_URL}{self.CREATE_ENDPOINT}',
|
||||
@@ -45,6 +46,10 @@ class BeorgService(IBeorgService):
|
||||
headers={'Content-Type': 'application/json'},
|
||||
) as response:
|
||||
data = await response.json(content_type=None)
|
||||
except TimeoutError:
|
||||
raise BeorgUnavailableException() from None
|
||||
except aiohttp.ClientError:
|
||||
raise BeorgUnavailableException() from None
|
||||
|
||||
if response.status >= 500:
|
||||
raise BeorgUnavailableException()
|
||||
@@ -59,6 +64,7 @@ class BeorgService(IBeorgService):
|
||||
async def get_result(self,user_token: str) -> BeorgKycResultResponse:
|
||||
self._ensure_configured()
|
||||
timeout = aiohttp.ClientTimeout(total=self._timeout)
|
||||
try:
|
||||
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||
async with session.get(
|
||||
f'{self.BASE_URL}{self.GET_RESULT_ENDPOINT}',
|
||||
@@ -69,6 +75,10 @@ class BeorgService(IBeorgService):
|
||||
headers={'Content-Type': 'application/json'},
|
||||
) as response:
|
||||
data = await response.json(content_type=None)
|
||||
except TimeoutError:
|
||||
raise BeorgUnavailableException() from None
|
||||
except aiohttp.ClientError:
|
||||
raise BeorgUnavailableException() from None
|
||||
|
||||
if response.status >= 500:
|
||||
raise BeorgUnavailableException()
|
||||
|
||||
@@ -39,7 +39,7 @@ class Settings(BaseSettings):
|
||||
KYC_POLL_SECONDS: int = 10
|
||||
KYC_POLL_BATCH_SIZE: int = 20
|
||||
EXCLUDED_PATHS: tuple[str,...] = ('/docs','/redoc','/openapi.json','/ping')
|
||||
BEORG_TIMEOUT: int = 15
|
||||
BEORG_TIMEOUT: int = 120
|
||||
BEORG_PROCESS_INFO: list[dict[str,Any]] = Field(default_factory=lambda: [
|
||||
{
|
||||
'key': 'SELFIE1',
|
||||
|
||||
Reference in New Issue
Block a user