diff --git a/buster/documents_manager/base.py b/buster/documents_manager/base.py index d6f5d39..584f26f 100644 --- a/buster/documents_manager/base.py +++ b/buster/documents_manager/base.py @@ -185,12 +185,14 @@ def batch_add( ) elapsed_time = time.time() - start_time - sleep_time = max(0, min_time_interval - elapsed_time) # Sleep to ensure the minimum time interval is maintained - if sleep_time > 0: - logger.info(f"Sleeping for {round(sleep_time)} seconds...") - time.sleep(sleep_time) + # Only sleep if it's not the last iteration + if batch_idx < total_batches - 1: + sleep_time = max(0, min_time_interval - elapsed_time) + if sleep_time > 0: + logger.info(f"Sleeping for {round(sleep_time)} seconds...") + time.sleep(sleep_time) logger.info("All batches processed.")