From 588ad52e4c42735ada82121124a1782e44735a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Odini?= Date: Tue, 21 May 2024 15:35:32 +0200 Subject: [PATCH] fix(data): fix daily data import script (#299) --- app/tasks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/tasks.py b/app/tasks.py index c2be40ab..94f16d30 100644 --- a/app/tasks.py +++ b/app/tasks.py @@ -171,11 +171,16 @@ def import_product_db( updated_count += execute_result.rowcount buffer_len += 1 + # update the database regularly if buffer_len % batch_size == 0: db.commit() logger.info(f"Products: {added_count} added, {updated_count} updated") buffer_len = 0 + # final database update + db.commit() + logger.info(f"Products: {added_count} added, {updated_count} updated. Done!") + # Locations # ------------------------------------------------------------------------------