wrongmove/tasks
Viktor Barzin 01a940b9b6 wrongmove: fix DetachedInstanceError in daily market aggregator task
`compute_aggregate_snapshot` returns ORM rows that were created inside
a `with Session(engine)` block — by the time the Celery task tries to
serialise their attributes into the result dict the session has closed,
triggering SQLAlchemy's DetachedInstanceError. Combined with acks_late
this caused the task to be redelivered repeatedly (4× in the first
manual trigger).

Fix: drop the per-row dict-serialisation in the task return — keep just
`aggregates_written: int`. The per-band stats are already logged by the
aggregator's own info-level lines, so no observability is lost.

Caught when manually firing the task on prod to seed today's snapshot
before the 04:00 UTC daily fire. Aggregator itself ran fine (the rows
were written before the session closed); only the post-return access
was broken.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 12:53:26 +00:00
..
listing_tasks.py wrongmove: stabilise setup_periodic_tasks tests after market-aggregator add 2026-05-16 12:07:50 +00:00
market_tasks.py wrongmove: fix DetachedInstanceError in daily market aggregator task 2026-05-16 12:53:26 +00:00
poi_tasks.py Add structured JSON logging, OTel business metrics, and Grafana dashboard 2026-02-14 10:59:12 +00:00
task_state.py Flatten repo structure: move crawler/ to root, remove vqa/ and immoweb/ 2026-02-07 23:01:20 +00:00