From 9c4db0d73c6605698c2d0ac3c9d142fe41dfac61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Arag=C3=B3n?= Date: Thu, 10 Oct 2024 12:26:58 +0200 Subject: [PATCH] feat: increase request timeout for upload --- client/qiskit_serverless/core/constants.py | 1 + client/qiskit_serverless/core/files.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/qiskit_serverless/core/constants.py b/client/qiskit_serverless/core/constants.py index 2931873a1..73e2ac51e 100644 --- a/client/qiskit_serverless/core/constants.py +++ b/client/qiskit_serverless/core/constants.py @@ -23,6 +23,7 @@ # request timeout REQUESTS_TIMEOUT: int = 30 +REQUESTS_STREAMING_TIMEOUT: int = 60 REQUESTS_TIMEOUT_OVERRIDE = "REQUESTS_TIMEOUT_OVERRIDE" # gateway diff --git a/client/qiskit_serverless/core/files.py b/client/qiskit_serverless/core/files.py index 2d7939a36..a7ba6c07e 100644 --- a/client/qiskit_serverless/core/files.py +++ b/client/qiskit_serverless/core/files.py @@ -33,7 +33,7 @@ from opentelemetry import trace from tqdm import tqdm -from qiskit_serverless.core.constants import REQUESTS_TIMEOUT +from qiskit_serverless.core.constants import REQUESTS_STREAMING_TIMEOUT, REQUESTS_TIMEOUT from qiskit_serverless.utils.json import safe_json_request @@ -95,7 +95,7 @@ def upload(self, file: str, provider: Optional[str] = None) -> Optional[str]: data={"provider": provider}, stream=True, headers={"Authorization": f"Bearer {self._token}"}, - timeout=REQUESTS_TIMEOUT, + timeout=REQUESTS_STREAMING_TIMEOUT, ) as req: if req.ok: return req.text