Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions 9 src/databricks/sql/auth/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from enum import Enum
from typing import List, Optional, Tuple, Union

import urllib3

# We only use this import for type hinting
try:
# If urllib3~=2.0 is installed
Expand All @@ -14,6 +16,8 @@
from urllib3 import HTTPResponse as BaseHTTPResponse
from urllib3 import Retry
from urllib3.util.retry import RequestHistory
from packaging import version


from databricks.sql.exc import (
CursorAlreadyClosedError,
Expand Down Expand Up @@ -308,8 +312,9 @@ def get_backoff_time(self) -> float:

current_attempt = self.stop_after_attempts_count - int(self.total or 0)
proposed_backoff = (2**current_attempt) * self.delay_min
if self.backoff_jitter != 0.0:
proposed_backoff += random.random() * self.backoff_jitter
if version.parse(urllib3.__version__) >= version.parse("2.0.0"):
if self.backoff_jitter != 0.0:
proposed_backoff += random.random() * self.backoff_jitter

proposed_backoff = min(proposed_backoff, self.delay_max)
self.check_proposed_wait(proposed_backoff)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.