We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb6d926 commit 672bed8Copy full SHA for 672bed8
src/databricks/sql/auth/retry.py
@@ -2,6 +2,7 @@
2
import random
3
import time
4
import typing
5
+from importlib.metadata import version
6
from enum import Enum
7
from typing import List, Optional, Tuple, Union
8
@@ -308,8 +309,11 @@ def get_backoff_time(self) -> float:
308
309
310
current_attempt = self.stop_after_attempts_count - int(self.total or 0)
311
proposed_backoff = (2**current_attempt) * self.delay_min
- if self.backoff_jitter != 0.0:
312
- proposed_backoff += random.random() * self.backoff_jitter
+
313
+ library_version = version("urllib3")
314
+ if int(library_version.split(".")[0]) >= 2:
315
+ if self.backoff_jitter != 0.0:
316
+ proposed_backoff += random.random() * self.backoff_jitter
317
318
proposed_backoff = min(proposed_backoff, self.delay_max)
319
self.check_proposed_wait(proposed_backoff)
0 commit comments