diff --git a/src/dispatch/case/views.py b/src/dispatch/case/views.py index 7e9ade924737..c1e1f9ae55a7 100644 --- a/src/dispatch/case/views.py +++ b/src/dispatch/case/views.py @@ -156,19 +156,21 @@ def create_case_resources( db_session: DbSession, case_id: PrimaryKey, current_case: CurrentCase, + background_tasks: BackgroundTasks, ): """Creates resources for an existing incident.""" individual_participants, team_participants = get_case_participants( case=current_case, db_session=db_session ) - case_create_resources_flow( + background_tasks.add_task( + case_create_resources_flow, db_session=db_session, case_id=case_id, individual_participants=individual_participants, team_participants=team_participants, ) - return current_case + # return current_case @router.put( diff --git a/src/dispatch/incident/views.py b/src/dispatch/incident/views.py index b9431a1d0ada..45cad962a0c9 100644 --- a/src/dispatch/incident/views.py +++ b/src/dispatch/incident/views.py @@ -149,10 +149,14 @@ def create_incident_resources( organization: OrganizationSlug, incident_id: PrimaryKey, current_incident: CurrentIncident, + background_tasks: BackgroundTasks, ): """Creates resources for an existing incident.""" - incident_create_resources_flow(organization_slug=organization, incident_id=incident_id) - return current_incident + background_tasks.add_task( + incident_create_resources_flow, organization_slug=organization, incident_id=incident_id + ) + + # return current_incident @router.put(