@@ -309,18 +309,24 @@ async def _process_qdrant_retry_queue(
309309 retry_queue : asyncio .Queue [list [models .PointStruct ]],
310310 * ,
311311 config : "QdrantRuntimeConfig" ,
312- ) -> None :
313- """Retry failed Qdrant batches with exponential backoff."""
312+ ) -> tuple [int , int ]:
313+ """Retry failed Qdrant batches with exponential backoff.
314+
315+ Returns a tuple containing the number of points that were retried successfully
316+ and the number that still failed after exhausting ``config.retry_attempts``.
317+ """
314318
315319 if retry_queue .empty ():
316- return
320+ return 0 , 0
317321
318322 pending = retry_queue .qsize ()
319323 logger .info ("Retrying %d failed Qdrant batches" , pending )
324+ succeeded_points = 0
325+ failed_points = 0
320326 while not retry_queue .empty ():
321327 batch = await retry_queue .get ()
322- attempt = 1
323- while attempt <= config .retry_attempts :
328+ batch_size = len ( batch )
329+ for attempt in range ( 1 , config .retry_attempts + 1 ) :
324330 try :
325331 await client .upsert (
326332 collection_name = collection_name ,
@@ -331,26 +337,29 @@ async def _process_qdrant_retry_queue(
331337 "Retry %d/%d failed for Qdrant batch of %d points" ,
332338 attempt ,
333339 config .retry_attempts ,
334- len ( batch ) ,
340+ batch_size ,
335341 )
336- attempt += 1
337- if attempt > config .retry_attempts :
342+ if attempt == config .retry_attempts :
338343 logger .error (
339344 "Giving up on Qdrant batch after %d attempts; %d points were not indexed" ,
340345 config .retry_attempts ,
341- len ( batch ) ,
346+ batch_size ,
342347 )
348+ failed_points += batch_size
343349 break
344- await asyncio .sleep (config .retry_backoff * attempt )
345- continue
350+
351+ next_attempt = attempt + 1
352+ await asyncio .sleep (config .retry_backoff * next_attempt )
346353 else :
347354 logger .info (
348355 "Successfully retried Qdrant batch of %d points on attempt %d" ,
349- len ( batch ) ,
356+ batch_size ,
350357 attempt ,
351358 )
359+ succeeded_points += batch_size
352360 break
353361
362+ return succeeded_points , failed_points
354363
355364__all__ = [
356365 "_DENSE_MODEL_PARAMS" ,
0 commit comments