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

Remove person_update_notifier task #787

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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