From e5ff1241406ec445979f8a1cd5deec7c0410ea7b Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 26 Dec 2025 18:09:37 -0600 Subject: [PATCH] fix: use allow_join_result for celery subtask result retrieval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Celery doesn't allow calling result.get() within a task by default to prevent deadlocks. Use allow_join_result() context manager since we've already confirmed the task is complete via ready() polling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- backend/app/services/video_renderer.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/app/services/video_renderer.py b/backend/app/services/video_renderer.py index 51cdab6..188207d 100644 --- a/backend/app/services/video_renderer.py +++ b/backend/app/services/video_renderer.py @@ -50,6 +50,7 @@ class VideoRendererService: Raises: FFmpegExecutionError: If the command fails """ + from celery.result import allow_join_result from ..tasks.ffmpeg_operations import run_ffmpeg_command # Dispatch to ffmpeg queue @@ -62,8 +63,10 @@ class VideoRendererService: while not task_result.ready(): await asyncio.sleep(0.5) - # Get result (should be ready, short timeout for safety) - result = task_result.get(timeout=30) + # Get result - use allow_join_result since we're calling from within a task + # This is safe because we've already confirmed the task is complete via ready() + with allow_join_result(): + result = task_result.get(timeout=30) if not result['success']: raise FFmpegExecutionError( @@ -85,6 +88,7 @@ class VideoRendererService: Raises: FFmpegExecutionError: If the command fails """ + from celery.result import allow_join_result from ..tasks.ffmpeg_operations import run_ffprobe_command # Dispatch to ffmpeg queue @@ -97,8 +101,10 @@ class VideoRendererService: while not task_result.ready(): await asyncio.sleep(0.2) - # Get result - result = task_result.get(timeout=30) + # Get result - use allow_join_result since we're calling from within a task + # This is safe because we've already confirmed the task is complete via ready() + with allow_join_result(): + result = task_result.get(timeout=30) if not result['success']: raise FFmpegExecutionError(