Skip to content

Commit 0555e6d

Browse files
committed
update
1 parent 4cd0160 commit 0555e6d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

databricks/sdk/retries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
from datetime import timedelta
44
from random import random, uniform
5-
from typing import Callable, Optional, Sequence, Type, TypeVar
5+
from typing import Callable, Optional, Sequence, Tuple, Type, TypeVar
66

77
from .clock import Clock, RealClock
88

@@ -105,7 +105,7 @@ def _backoff(attempt: int) -> float:
105105
# It is used internally by the SDK to poll for the result of an operation.
106106
# It can be changed in the future without any notice.
107107
def poll(
108-
fn: Callable[[], tuple[Optional[T], Optional[RetryError]]],
108+
fn: Callable[[], Tuple[Optional[T], Optional[RetryError]]],
109109
timeout: timedelta = timedelta(minutes=20),
110110
clock: Optional[Clock] = None,
111111
) -> T:

tests/test_retries.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import timedelta
2-
from typing import Any, Literal, Optional, Type
2+
from typing import Any, Literal, Optional, Tuple, Type
33

44
import pytest
55

@@ -99,7 +99,7 @@ def foo():
9999
None,
100100
60,
101101
3.10,
102-
3.90,
102+
4.50,
103103
id="returns dict after 2 retries with linear backoff (1s+2s)",
104104
),
105105
pytest.param(
@@ -109,8 +109,8 @@ def foo():
109109
None,
110110
None,
111111
60,
112-
10.25,
113-
11.75,
112+
10.2,
113+
13.0,
114114
id="returns list after 4 retries with linear backoff (1s+2s+3s+4s)",
115115
),
116116
pytest.param(
@@ -252,7 +252,7 @@ def test_poll_behavior(
252252
clock: FakeClock = FakeClock()
253253
call_count: int = 0
254254

255-
def fn() -> tuple[Any, Optional[RetryError]]:
255+
def fn() -> Tuple[Any, Optional[RetryError]]:
256256
nonlocal call_count
257257
call_count += 1
258258

@@ -290,6 +290,6 @@ def fn() -> tuple[Any, Optional[RetryError]]:
290290
assert call_count >= 1
291291

292292
if scenario == "timeout":
293-
assert clock.time() >= min_time - 1
293+
assert clock.time() >= min_time
294294
elif scenario in ("halt", "unexpected"):
295295
assert call_count == attempts

0 commit comments

Comments
 (0)