Skip to content

Commit f044fcb

Browse files
authored
fix(python): Set timeout correctly and update test (#242)
Fixes computing the `Timeout` connection parameter and updates the test to use our top-level `timeout_ms` option rather than the lower-level connection parameter directly. Ref FS-190
1 parent b2fb0ca commit f044fcb

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

clients/python/src/objectstore_client/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(
113113

114114
if timeout_ms:
115115
connection_kwargs_to_use["timeout"] = urllib3.Timeout(
116-
connect=timeout_ms * 100, read=timeout_ms * 100
116+
connect=timeout_ms / 1000, read=timeout_ms / 1000
117117
)
118118

119119
if connection_kwargs:

clients/python/tests/test_e2e.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ def test_connect_timeout() -> None:
157157
addr = s.getsockname()
158158
url = f"http://127.0.0.1:{addr[1]}"
159159

160-
timeout = urllib3.Timeout(connect=0.05, read=0.05) # 50ms
161-
162-
client = Client(url, connection_kwargs={"timeout": timeout})
160+
client = Client(url, timeout_ms=50)
163161
test_usecase = Usecase(
164162
"test-usecase",
165163
compression="zstd",

0 commit comments

Comments
 (0)