diff --git a/weaviate/collections/batch/async_.py b/weaviate/collections/batch/async_.py index 8b997586c..c63ec2106 100644 --- a/weaviate/collections/batch/async_.py +++ b/weaviate/collections/batch/async_.py @@ -225,7 +225,7 @@ async def __loop(self) -> None: # wait for more objects to be added up to the batch size await asyncio.sleep(refresh_time) if time.time() - start >= 1 and ( - len_o == len(self.__batch_objects) or len_r == len(self.__batch_references) + len_o == len(self.__batch_objects) and len_r == len(self.__batch_references) ): # no new objects were added in the last second, exit the loop break diff --git a/weaviate/collections/batch/base.py b/weaviate/collections/batch/base.py index af6a9ea49..721b9b61d 100644 --- a/weaviate/collections/batch/base.py +++ b/weaviate/collections/batch/base.py @@ -434,7 +434,7 @@ def __batch_send(self) -> None: # shutdown was requested, exit the loop break if time.time() - start >= 1 and ( - len_o == len(self.__batch_objects) or len_r == len(self.__batch_references) + len_o == len(self.__batch_objects) and len_r == len(self.__batch_references) ): # no new objects were added in the last second, exit the loop break diff --git a/weaviate/collections/batch/sync.py b/weaviate/collections/batch/sync.py index 6627f8911..6cf8c1edc 100644 --- a/weaviate/collections/batch/sync.py +++ b/weaviate/collections/batch/sync.py @@ -177,7 +177,7 @@ def __loop(self) -> None: # wait for more objects to be added up to the batch size time.sleep(refresh_time) if time.time() - start >= 1 and ( - len_o == len(self.__batch_objects) or len_r == len(self.__batch_references) + len_o == len(self.__batch_objects) and len_r == len(self.__batch_references) ): # no new objects were added in the last second, exit the loop break