feat(workers): supply-layers refresh task + weekly beat (#950 Step 5) #1005

Merged
Light1YT merged 1 commit from feat/950d-supply-layers-worker into main 2026-06-02 20:47:06 +00:00

1 commit

Author SHA1 Message Date
1db488ba99 feat(workers): supply-layers refresh task + weekly beat (#950 Step 5)
Celery task tasks.supply_layers_refresh computes L1/L2/L3 supply layers per
Sverdlovsk district via supply_layers.compute_all_layers and UPSERTs into
supply_layers (m.125) on uq_supply_layers_logical, updating all mutable cols
(units/area/expected_online_date/confidence/method/computed_at), never the key.
Coherent single date.today() snapshot_date across the batch; per-row SAVEPOINT
(begin_nested) so a bad row/district can't abort the weekly batch; per-district
guard. District set is data-driven (UNION of objective_lots.district and
domrf_kn_objects.district_name region_cd=66), not hardcoded.

Registered weekly Mon 06:00 МСК (after scrape_kn 04:15 that refreshes free_flats,
the L2 source). Adds the task module to celery_app include (beat resolves by
name). 11 unit tests asserting the ON CONFLICT contract + savepoint + coherent
snapshot.
2026-06-03 01:45:30 +05:00