From 9321ac04a71ae66c7fdd1667a0a51665b0761a5b Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Wed, 7 Feb 2024 18:04:15 -0700 Subject: [PATCH] Fix #175 : if concurrency and ordered, warn. --- astrapy/db.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/astrapy/db.py b/astrapy/db.py index e4ea0eb5..ac50b3b0 100644 --- a/astrapy/db.py +++ b/astrapy/db.py @@ -722,6 +722,12 @@ def chunked_insert_many( """ results: List[Union[API_RESPONSE, Exception]] = [] + # Raise a warning if ordered and concurrency + if options and options.get("ordered") is True and concurrency > 1: + logger.warning( + "Using ordered insert with concurrency may lead to unexpected results." + ) + # If we have concurrency as 1, don't use a thread pool if concurrency == 1: # Split the documents into chunks