From af8fa2938ddf3559348ae87f8c8bc721b4fcc63e Mon Sep 17 00:00:00 2001 From: Jimmy Kim Date: Sat, 16 Nov 2024 13:09:55 +0900 Subject: [PATCH] fix bug on duplicate key --- src/sbosc/worker/worker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sbosc/worker/worker.py b/src/sbosc/worker/worker.py index c50474a..1b649f1 100644 --- a/src/sbosc/worker/worker.py +++ b/src/sbosc/worker/worker.py @@ -116,6 +116,10 @@ def bulk_import(self): start_pk = self.get_start_pk(chunk_info) if start_pk is None: return + # If the start_pk is greater than the end_pk, set the last_pk_inserted to end_pk + # This can happen when chunk ended with a duplicate key error + elif start_pk > chunk_info.end_pk: + chunk_info.last_pk_inserted = chunk_info.end_pk end_pk = chunk_info.end_pk chunk_info.status = ChunkStatus.IN_PROGRESS