Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added version check for urllib3 #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
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
8 changes: 6 additions & 2 deletions src/databricks/sql/auth/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import random
import time
import typing
from importlib.metadata import version
from enum import Enum
from typing import List, Optional, Tuple, Union

Expand Down Expand Up @@ -308,8 +309,11 @@ 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

library_version = version("urllib3")
if int(library_version.split(".")[0]) >= 2:
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
Loading