Merge pull request #680 from zomglings/fix-crawler-tx-rollback

Added transaction rollback when there is a violation of unique constraint when crawling blocks
pull/682/head
Sergei Sumarokov 2022-10-18 17:13:44 +03:00 zatwierdzone przez GitHub
commit a8470441cb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -215,8 +215,9 @@ def crawl_blocks(
db_session.commit()
except IntegrityError as err:
db_session.rollback()
assert isinstance(err.orig, UniqueViolation)
logger.warning(
logger.error(
"UniqueViolation error occurred, it means block already exists"
)
except Exception as err:

3
db/.gitignore vendored
Wyświetl plik

@ -190,3 +190,6 @@ alembic.docker.ini
# Schematic
srv/
.schematic.env
# Custom
scratch/