💩(backend) notify the summary service when a new recording is available

Draft a piece of code to try the feature in staging. I'll consolidate this
implementation ASAP, as soon we have a first implementation functional.

What's missing?
- when owners are multiple
- retry when the backend cannot reach the summary service
- factorize the key oneliner, duplicated from the egress service
- optimize SQL query
- unit tests
This commit is contained in:
lebaudantoine
2024-12-02 13:16:43 +01:00
committed by aleb_the_flash
parent 300756b323
commit 4fe01ae2bf
6 changed files with 151 additions and 19 deletions

View File

@@ -32,6 +32,7 @@ from core.recording.event.exceptions import (
InvalidFileTypeError,
ParsingEventDataError,
)
from core.recording.event.notification import notification_service
from core.recording.event.parsers import get_parser
from core.recording.worker.exceptions import (
RecordingStartError,
@@ -448,7 +449,17 @@ class RecordingViewSet(
" in an error state or has already been saved."
)
recording.status = models.RecordingStatusChoices.SAVED
# Attempt to notify external services about the recording
# This is a non-blocking operation - failures are logged but don't interrupt the flow
notification_succeeded = notification_service.notify_external_services(
recording
)
recording.status = (
models.RecordingStatusChoices.NOTIFICATION_SUCCEEDED
if notification_succeeded
else models.RecordingStatusChoices.SAVED
)
recording.save()
return drf_response.Response(