Skip to content

Commit 9c393ca

Browse files
committed
Fix event-loop-blocking time.sleep in async wait_for_weaviate
The async ConnectionAsync.wait_for_weaviate startup-retry loop called time.sleep(1), blocking the whole event loop for up to startup_period seconds. Use await asyncio.sleep(1) so the loop stays responsive, matching the async-sleep pattern already used elsewhere (retry.py, export/executor.py). The synchronous wait_for_weaviate is unchanged.
1 parent 110df05 commit 9c393ca

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

weaviate/connect/v4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import asyncio
34
import time
45
from copy import copy
56
from dataclasses import dataclass, field
@@ -1159,7 +1160,7 @@ async def wait_for_weaviate(self, startup_period: int) -> None:
11591160
).raise_for_status()
11601161
return
11611162
except (ConnectError, ReadError, TimeoutError, HTTPStatusError):
1162-
time.sleep(1)
1163+
await asyncio.sleep(1)
11631164

11641165
try:
11651166
(

0 commit comments

Comments
 (0)