Backend: Long-running base repricer operations (full sync, recalculation, export) now run in background tasks so the API remains responsive.
WebSocket: Added centralized task_status messages with source: "base" for sync, recalculate and export flows so the frontend sees a single canonical indicator for base activity.
Converted /recalculate/{sku} and /export-updates to run as background tasks.
notify_clients calls for start/finish now run from the background worker and emit canonical task_status payloads.
repricer_articles.py
sync/{sku} now schedules the heavy sync work in a background task which uses SessionLocal() internally to avoid leaking request DB sessions.
Background sync task emits task_status messages with source: "base" for sync start/finish.
Background recalculation routine (triggered after sync / UVP updates) now emits base-scoped recalculate and exporttask_status messages (start/finish) around the work.
UVP propagation background task consolidated to run recalculation + platform exports and notify clients with source: "base".
Use of local SessionLocal() inside background workers to ensure DB sessions are short-lived and safe across awaits.
Fixed blocking endpoints by moving heavy work to background tasks so the server remains responsive under large sync/export runs.
Removed duplicated synchronous export path in shopify_articles.py and replaced it with the single background implementation.
Ensured notify_clients payloads are canonical task_status dicts (source/task/active/started_at/finished_at/success) so the frontend mapping works reliably.
No DB schema migrations required — only runtime behavior changed.
To verify:
Trigger a base sync: call the sync/{sku} route and watch the WebSocket /api/v1/multi/ws for task_status messages where source is base and task is sync.
Trigger a recalc/export: POST to /recalculate/{sku} or /export-updates and confirm baserecalculate/export messages appear (start and finish) in the WS stream.
Optionally use the debug endpoint /system/tasks/send to emit a test message for connected clients.
If you run multiple backend instances and need shared task state across processes, persist running_map to Redis (recommended) or a shared JSON store. Current persistence is process-local.