mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
fix(infra): handle database deduplication unique constraints in db buffer
- Intercepts psycopg2 UniqueViolation exceptions on the ene_pkg_hash_idx unique index constraint. - Logs duplicate content violations as successful deduplication skips instead of triggering transaction retries and fallback logging. Build: 0 jobs, 0 errors (lake build)
This commit is contained in:
parent
e6bbb612d0
commit
50322c88f9
1 changed files with 4 additions and 0 deletions
|
|
@ -259,6 +259,10 @@ class AsyncDatabaseBuffer:
|
|||
self.conn.commit()
|
||||
except Exception as e:
|
||||
self.conn.rollback()
|
||||
# Catch duplicate content hash violations and skip them cleanly as successful dedups
|
||||
if e.__class__.__name__ == "UniqueViolation" and "ene_pkg_hash_idx" in str(e):
|
||||
log.info("Deduplication filter triggered: record with identical content_hash already exists. Skipping.")
|
||||
return
|
||||
raise e
|
||||
finally:
|
||||
cur.close()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue