Skip to content

Commit

Permalink
Reduces likelihood of incident_update_flow() running before incident_…
Browse files Browse the repository at this point in the history
…service.update() completes.
  • Loading branch information
metroid-samus committed Jan 26, 2024
1 parent e248253 commit 243772f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/dispatch/incident/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from dispatch.group.enums import GroupType, GroupAction
from dispatch.incident import service as incident_service
from dispatch.incident.models import IncidentRead
from dispatch.incident_cost import service as incident_cost_service
from dispatch.individual import service as individual_service
from dispatch.participant import flows as participant_flows
from dispatch.participant import service as participant_service
Expand Down Expand Up @@ -666,6 +667,11 @@ def incident_update_flow(
# we update the external ticket
ticket_flows.update_incident_ticket(incident_id=incident.id, db_session=db_session)

# Update total incident reponse cost.
incident_cost_service.update_incident_response_cost(
incident_id=incident.id, db_session=db_session
)

if incident.status == IncidentStatus.active:
# we re-resolve and add individuals to the incident
individual_participants, team_participants = get_incident_participants(incident, db_session)
Expand Down
5 changes: 0 additions & 5 deletions src/dispatch/incident/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,6 @@ def update(*, db_session, incident: Incident, incident_in: IncidentUpdate) -> In
incident.visibility = incident_in.visibility

db_session.commit()

# Update total incident reponse cost.
incident_cost_service.update_incident_response_cost(
incident_id=incident.id, db_session=db_session
)
return incident


Expand Down

0 comments on commit 243772f

Please sign in to comment.