Skip to content

Commit

Permalink
Remove person_update_notifier task
Browse files Browse the repository at this point in the history
It has never been configured to event run and is
causing us sentry issues.
  • Loading branch information
SamDudley committed Oct 25, 2024
1 parent 214276e commit 0cbbe93
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 54 deletions.
5 changes: 0 additions & 5 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ HAWK_INCOMING_SECRET_KEY=xxx
PAGINATION_PAGE_SIZE=100
PAGINATION_MAX_PAGE_SIZE=100

# Person update web hook
PERSON_UPDATE_HAWK_ID=
PERSON_UPDATE_HAWK_KEY=
PERSON_UPDATE_WEBHOOK_URL=

# UK Staff Locations DB
UK_STAFF_LOCATIONS_DATABASE_URL=psql://postgres:postgres@db:5432/uk_staff_locations

Expand Down
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ HAWK_INCOMING_SECRET_KEY=xxx
PAGINATION_PAGE_SIZE=100
PAGINATION_MAX_PAGE_SIZE=1000

# Person update web hook
PERSON_UPDATE_HAWK_ID=
PERSON_UPDATE_HAWK_KEY=
PERSON_UPDATE_WEBHOOK_URL=

# People finder migration (PFM)
LEGACY_PEOPLEFINDER_DATABASE_URL=
PFM_AWS_STORAGE_BUCKET_NAME=
Expand Down
5 changes: 0 additions & 5 deletions src/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,6 @@ def filter_transactions(event, hint):
PAGINATION_PAGE_SIZE = env.int("PAGINATION_PAGE_SIZE", 100)
PAGINATION_MAX_PAGE_SIZE = env.int("PAGINATION_MAX_PAGE_SIZE", 100)

# Person update web hook
PERSON_UPDATE_HAWK_ID = env("PERSON_UPDATE_HAWK_ID", None)
PERSON_UPDATE_HAWK_KEY = env("PERSON_UPDATE_HAWK_KEY", None)
PERSON_UPDATE_WEBHOOK_URL = env("PERSON_UPDATE_WEBHOOK_URL", None)

# Home page
HIDE_NEWS = env.bool("HIDE_NEWS", False)

Expand Down
5 changes: 1 addition & 4 deletions src/peoplefinder/services/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
AuditLogService,
ObjectRepr,
)
from peoplefinder.tasks import notify_user_about_profile_changes, person_update_notifier
from peoplefinder.tasks import notify_user_about_profile_changes
from peoplefinder.types import EditSections, ProfileSections
from user.models import User

Expand Down Expand Up @@ -306,9 +306,6 @@ def profile_updated(

self.trigger_profile_change_notification(request, person)

# Notify external services
person_update_notifier.delay(person.id)

def profile_deletion_initiated(
self, request: Optional[HttpRequest], person: Person, initiated_by: User
) -> None:
Expand Down
35 changes: 0 additions & 35 deletions src/peoplefinder/tasks.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
import requests
from celery import shared_task
from django.conf import settings
from requests_hawk import HawkAuth

from config.celery import celery_app
from peoplefinder.models import Person
from peoplefinder.views.api.person import PersonSerializer


@shared_task
def person_update_notifier(person_id):
if not settings.PERSON_UPDATE_WEBHOOK_URL:
return

person = (
Person.objects.get_annotated()
.defer(
"photo",
"do_not_work_for_dit",
)
.get(pk=person_id)
)

serializer = PersonSerializer(person)

hawk_auth = HawkAuth(
id=settings.PERSON_UPDATE_HAWK_ID,
key=settings.PERSON_UPDATE_HAWK_KEY,
)
requests.post(
settings.PERSON_UPDATE_WEBHOOK_URL,
auth=hawk_auth,
data=serializer.data,
timeout=5,
)


@celery_app.task(bind=True)
Expand Down

0 comments on commit 0cbbe93

Please sign in to comment.