Skip to content

Commit

Permalink
fix(data): fix daily data import script (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed May 21, 2024
1 parent 43485ed commit 588ad52
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 588ad52

Please sign in to comment.