perf(mdm): Route all sync/push actions through Dagster to prevent request hangs#136
perf(mdm): Route all sync/push actions through Dagster to prevent request hangs#136
Conversation
…uest hangs Agent-Logs-Url: https://github.com/caktus/publish-mdm/sessions/0fe2549d-ea3c-40d9-8d79-7c985aae8026 Co-authored-by: simonkagwi <1660282+simonkagwi@users.noreply.github.com>
|
@copilot The sync_fleets_job Dagster job should be able to sync specific fleets, instead of always syncing all fleets. When triggered from the devices list page, it should only sync fleets related to the current organization, similar to the non-Dagster flow |
Agent-Logs-Url: https://github.com/caktus/publish-mdm/sessions/e911e370-935f-4ecd-a3ad-c6f077a2a8c4 Co-authored-by: simonkagwi <1660282+simonkagwi@users.noreply.github.com>
Done in eb27cc1. The |
Synchronous MDM API calls in the request/response cycle (sync fleet, push device config, push policy child devices) block for orgs with many devices. Dagster was already wired up for device CSV imports in
apps/mdm/but five other call sites remained synchronous.New Dagster infrastructure
sync_and_push_mdm_devicesasset — accepts afleet_pks: list[int]config and callssync_fleet()for each specified fleet withpush_config=Truesync_fleets_job— new job targeting the asset, used for the devices-list sync buttonUpdated call sites
All five sites now follow the same pattern: trigger Dagster when
dagster_enabled(), fall back to synchronous behavior when it isn't (local dev / noDAGSTER_URL).devices_list"Sync" buttontrigger_dagster_job("sync_fleets_job", {fleet_pks: [...]})with the current org's fleet PKs → "Sync queued" messagedevice_update_app_userHTMXtrigger_dagster_job("mdm_job", {device_pks: [pk]})publish_mdm/import_export.pyafter_importtrigger_dagster_job("mdm_job", {device_pks: [...]})mdm/views.py_push_policy_to_mdmmdm_jobmdm/admin.pyPolicyAdmin.save_relatedThe
sync_fleets_jobis scoped to the organization whose sync button was pressed — only that org's fleet PKs are passed in the run config, matching the non-Dagster per-fleet loop behaviour.Tests
New test classes added for each site asserting: