🐛(summary) fix failure webhook notification

Computation was off by 1.
Also improve the logging.
This commit is contained in:
Florent Chehab
2026-04-02 22:54:10 +02:00
parent 34f9dea73f
commit 45c5a443fb
2 changed files with 27 additions and 9 deletions
+1
View File
@@ -31,6 +31,7 @@ and this project adheres to
- ⬆️(dependencies) update vite to v7.3.2 [SECURITY]
- ⬆️(dependencies) update django to v5.2.13 [SECURITY]
- 🔒(backend) rely on backend to allow participant update their metadata
- 🐛(summary) fix failure webhook notification #1233
## [1.13.0] - 2026-03-31
+26 -9
View File
@@ -52,7 +52,6 @@ metadata_manager = MetadataManager()
logger = get_task_logger(__name__)
celery = Celery(
__name__,
broker=settings.celery_broker_url,
@@ -497,13 +496,22 @@ def handle_transcribe_v2_failed(
This function is triggered when the transcribe_v2_task fails.
It sends a webhook failure payload to notify the client of the failure.
"""
task = sender
# If retries are exhausted:
if task.request.retries >= task.max_retries:
n_retries_left = sender.max_retries - sender.request.retries - 1
if n_retries_left > 0:
logger.info(
"Transcribe task %s failed, %s retries left.",
task_id,
n_retries_left,
)
else:
logger.warn(
"Transcribe task %s failed, no more retries left, sending failure webhook.",
task_id,
)
call_webhook_v2_task.apply_async(
args=[
TranscribeWebhookFailurePayload(
job_id=task.id,
job_id=task_id,
error_code="unknown_error",
).model_dump(),
args[0]["tenant_id"],
@@ -562,13 +570,22 @@ def handle_summarize_v2_failed(
This function is triggered when the summarize_v2_task fails.
It sends a webhook failure payload to notify the client of the failure.
"""
task = sender
# If retries are exhausted:
if task.request.retries >= task.max_retries:
n_retries_left = sender.max_retries - sender.request.retries - 1
if n_retries_left > 0:
logger.info(
"Summary task %s failed, %s retries left.",
task_id,
n_retries_left,
)
else:
logger.warn(
"Summary task %s failed, no more retries left, sending failure webhook.",
task_id,
)
call_webhook_v2_task.apply_async(
args=[
SummarizeWebhookFailurePayload(
job_id=task.id,
job_id=task_id,
error_code="unknown_error",
).model_dump(),
args[0]["tenant_id"],