Skip to content

Commit 4651cd6

Browse files
pass test_retry_exponential_backoff
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent ebc1915 commit 4651cd6

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/databricks/sql/backend/sea/utils/http_client.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from databricks.sql.auth.authenticators import AuthProvider
1313
from databricks.sql.auth.retry import CommandType, DatabricksRetryPolicy
1414
from databricks.sql.types import SSLOptions
15-
from databricks.sql.exc import RequestError
15+
from databricks.sql.exc import RequestError, MaxRetryDurationError
1616

1717
logger = logging.getLogger(__name__)
1818

@@ -249,14 +249,21 @@ def _make_request(
249249
if self._pool is None:
250250
raise RequestError("Connection pool not initialized", None)
251251

252-
response = self._pool.request(
253-
method=method.upper(),
254-
url=url,
255-
body=body,
256-
headers=headers,
257-
preload_content=True,
258-
retries=self.retry_policy,
259-
)
252+
try:
253+
response = self._pool.request(
254+
method=method.upper(),
255+
url=url,
256+
body=body,
257+
headers=headers,
258+
preload_content=True,
259+
retries=self.retry_policy,
260+
)
261+
except MaxRetryDurationError as e:
262+
# MaxRetryDurationError is raised directly by DatabricksRetryPolicy
263+
# when duration limits are exceeded (like in test_retry_exponential_backoff)
264+
error_message = f"Request failed due to retry duration limit: {e}"
265+
# Construct RequestError with message, context, and specific error (like Thrift backend)
266+
raise RequestError(error_message, None, e)
260267

261268
logger.debug(f"Response status: {response.status}")
262269

0 commit comments

Comments
 (0)