fix: use allow_join_result for celery subtask result retrieval

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 <noreply@anthropic.com>
This commit is contained in:
michael 2025-12-26 18:09:37 -06:00
parent bf1c321088
commit e5ff124140

View file

@ -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(