fix(scrapers): commit outer tx в domrf_catalog scrape_catalog_batch (#1227) #1272
1 changed files with 11 additions and 0 deletions
|
|
@ -553,6 +553,17 @@ async def scrape_catalog_batch(
|
|||
else:
|
||||
stats["failed"] += 1
|
||||
|
||||
# Commit outer transaction: SAVEPOINT (`begin_nested`) в upsert_catalog_data
|
||||
# лишь RELEASE'ит внутренний SAVEPOINT, но outer tx остаётся autobegin'd —
|
||||
# без commit() все UPDATE'ы (цены, отделка, catalog_updated_at) откатятся
|
||||
# при db.close() в Celery task. Зеркалит scrape_catalog_objects в
|
||||
# domrf_catalog_object.py:460. Issue #1227.
|
||||
try:
|
||||
db.commit()
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
logger.info(
|
||||
"scrape_catalog_batch done: total=%d success=%d failed=%d fields_total=%d",
|
||||
stats["total"],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue