Skip to content

Commit

Permalink
Sets resource creation as a background task.
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus committed Sep 22, 2023
1 parent d17fe16 commit dc1b7e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/dispatch/case/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 6 additions & 2 deletions src/dispatch/incident/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit dc1b7e8

Please sign in to comment.