fix(scrapers): commit outer tx в domrf_catalog scrape_catalog_batch (#1227)
Some checks are pending
Deploy / deploy (push) Blocked by required conditions
Deploy / changes (push) Waiting to run
Deploy / build-backend (push) Blocked by required conditions
Deploy / build-worker (push) Blocked by required conditions
Deploy / build-frontend (push) Blocked by required conditions
Some checks are pending
Deploy / deploy (push) Blocked by required conditions
Deploy / changes (push) Waiting to run
Deploy / build-backend (push) Blocked by required conditions
Deploy / build-worker (push) Blocked by required conditions
Deploy / build-frontend (push) Blocked by required conditions
begin_nested() лишь RELEASE'ит SAVEPOINT — без db.commit() все UPDATE цен откатывались при db.close() в Celery task. Зеркалит правильный паттерн scrape_catalog_objects (domrf_catalog_object.py:460): try- commit/except-rollback в конце функции. 50 catalog тестов зелёные. Closes #1227
This commit is contained in:
parent
931273628a
commit
e71224ef54
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