Skip to content

Commit 33806d8

Browse files
committed
Only assign self._connected at end of .connect() method
1 parent ee23524 commit 33806d8

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

weaviate/connect/v4.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,6 @@ def connect(self) -> None:
894894
if self._connected:
895895
return None
896896

897-
self._connected = True
898-
899897
self._open_connections_rest(self._auth, "sync")
900898

901899
# need this to get the version of weaviate for version checks and proper GRPC configuration
@@ -940,6 +938,8 @@ def connect(self) -> None:
940938
self._connected = False
941939
raise e
942940

941+
self._connected = True
942+
943943
def wait_for_weaviate(self, startup_period: int) -> None:
944944
for _i in range(startup_period):
945945
try:
@@ -1073,8 +1073,6 @@ async def connect(self) -> None:
10731073
if self._connected:
10741074
return None
10751075

1076-
self._connected = True
1077-
10781076
await executor.aresult(self._open_connections_rest(self._auth, "async"))
10791077

10801078
# need this to get the version of weaviate for version checks and proper GRPC configuration
@@ -1096,7 +1094,6 @@ async def connect(self) -> None:
10961094
raise WeaviateStartUpError(f"Could not connect to Weaviate:{e}.") from e
10971095

10981096
self.open_connection_grpc("async")
1099-
self._connected = True
11001097
if self.embedded_db is not None:
11011098
try:
11021099
await self.wait_for_weaviate(10)

0 commit comments

Comments
 (0)