File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 5
5
from enum import Enum
6
6
from typing import List , Optional , Tuple , Union
7
7
8
+ import urllib3
9
+
8
10
# We only use this import for type hinting
9
11
try :
10
12
# If urllib3~=2.0 is installed
14
16
from urllib3 import HTTPResponse as BaseHTTPResponse
15
17
from urllib3 import Retry
16
18
from urllib3 .util .retry import RequestHistory
19
+ from packaging import version
20
+
17
21
18
22
from databricks .sql .exc import (
19
23
CursorAlreadyClosedError ,
@@ -308,8 +312,9 @@ def get_backoff_time(self) -> float:
308
312
309
313
current_attempt = self .stop_after_attempts_count - int (self .total or 0 )
310
314
proposed_backoff = (2 ** current_attempt ) * self .delay_min
311
- if self .backoff_jitter != 0.0 :
312
- proposed_backoff += random .random () * self .backoff_jitter
315
+ if version .parse (urllib3 .__version__ ) >= version .parse ("2.0.0" ):
316
+ if self .backoff_jitter != 0.0 :
317
+ proposed_backoff += random .random () * self .backoff_jitter
313
318
314
319
proposed_backoff = min (proposed_backoff , self .delay_max )
315
320
self .check_proposed_wait (proposed_backoff )
You can’t perform that action at this time.
0 commit comments