Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timers to func calls in add_or_reactivate_participant #2967

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add timers to func calls in add_or_reactivate_participant
  • Loading branch information
wssheldon committed Feb 10, 2023
commit 6aaa138b74d83e78cf44a9e2afd62d39db181a64
3 changes: 3 additions & 0 deletions src/dispatch/incident/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime
from typing import Any, List

from dispatch.decorators import timer
from dispatch.conference import service as conference_service
from dispatch.conference.models import ConferenceCreate
from dispatch.conversation import service as conversation_service
Expand Down Expand Up @@ -599,6 +600,7 @@ def set_conversation_bookmarks(incident: Incident, db_session: SessionLocal):
log.exception(e)


@timer
def add_participants_to_conversation(
participant_emails: List[str], incident: Incident, db_session: SessionLocal
):
Expand Down Expand Up @@ -630,6 +632,7 @@ def add_participants_to_conversation(
log.exception(e)


@timer
def add_participant_to_tactical_group(
user_email: str, incident: Incident, db_session: SessionLocal
):
Expand Down
5 changes: 5 additions & 0 deletions src/dispatch/incident/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import logging

from dispatch.decorators import timer
from dispatch.config import DISPATCH_UI_URL
from dispatch.conversation.enums import ConversationCommands
from dispatch.database.core import SessionLocal, resolve_attr
Expand Down Expand Up @@ -214,6 +215,7 @@ def send_welcome_email_to_participant(
log.debug(f"Welcome email sent to {participant_email}.")


@timer
def send_incident_welcome_participant_messages(
participant_email: str, incident: Incident, db_session: SessionLocal
):
Expand All @@ -227,6 +229,7 @@ def send_incident_welcome_participant_messages(
log.debug(f"Welcome participant messages sent {participant_email}.")


@timer
def get_suggested_document_items(incident: Incident, db_session: SessionLocal):
"""Create the suggested document item message."""
suggested_documents = get_suggested_documents(db_session, incident)
Expand All @@ -246,6 +249,7 @@ def get_suggested_document_items(incident: Incident, db_session: SessionLocal):
return items


@timer
def send_incident_suggested_reading_messages(
incident: Incident, items: list, participant_email: str, db_session: SessionLocal
):
Expand Down Expand Up @@ -464,6 +468,7 @@ def send_incident_update_notifications(
log.debug("Incident updated notifications sent.")


@timer
def send_incident_participant_announcement_message(
participant_email: str, incident: Incident, db_session: SessionLocal
):
Expand Down
3 changes: 3 additions & 0 deletions src/dispatch/participant/flows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from typing import TypeVar

from dispatch.decorators import timer
from dispatch.case.models import Case
from dispatch.database.core import SessionLocal, get_table_name_by_class_instance
from dispatch.event import service as event_service
Expand All @@ -21,6 +22,7 @@
Subject = TypeVar("Subject", Case, Incident)


@timer
def add_participant(
user_email: str,
subject: Subject,
Expand Down Expand Up @@ -147,6 +149,7 @@ def inactivate_participant(user_email: str, incident: Incident, db_session: Sess
return True


@timer
def reactivate_participant(
user_email: str, incident: Incident, db_session: SessionLocal, service_id: int = None
):
Expand Down
3 changes: 3 additions & 0 deletions src/dispatch/participant/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List, Optional

from dispatch.decorators import timer
from dispatch.case import service as case_service
from dispatch.incident import service as incident_service
from dispatch.individual import service as individual_service
Expand Down Expand Up @@ -43,6 +44,7 @@ def get_by_case_id_and_role(*, db_session, case_id: int, role: str) -> Optional[
)


@timer
def get_by_incident_id_and_email(
*, db_session, incident_id: int, email: str
) -> Optional[Participant]:
Expand All @@ -67,6 +69,7 @@ def get_by_case_id_and_email(*, db_session, case_id: int, email: str) -> Optiona
)


@timer
def get_by_incident_id_and_service_id(
*, db_session, incident_id: int, service_id: int
) -> Optional[Participant]:
Expand Down