From e873cd68371930e5e26d7678782f4fdbff9c5f4e Mon Sep 17 00:00:00 2001 From: Andy Warren <6464347+padioca@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:28:31 -0500 Subject: [PATCH] fix: run Frigate+ API calls in thread pool to prevent event loop blocking The send_to_plus and set_false_positive handlers are async but call synchronous PlusApi methods (which use the requests library) directly, blocking the asyncio event loop for 10-16 seconds during image upload. This stalls all other HTTP requests to Frigate. Wrap upload_image, add_annotation, and add_false_positive calls in asyncio.to_thread() so they run in a thread pool without blocking. Fixes #16566 --- frigate/api/event.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frigate/api/event.py b/frigate/api/event.py index b0a749018..6322c95ce 100644 --- a/frigate/api/event.py +++ b/frigate/api/event.py @@ -11,6 +11,7 @@ from functools import reduce from pathlib import Path from typing import List from urllib.parse import unquote +import asyncio import cv2 import numpy as np @@ -1124,7 +1125,7 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N ) try: - plus_id = request.app.frigate_config.plus_api.upload_image(image, event.camera) + plus_id = await asyncio.to_thread(request.app.frigate_config.plus_api.upload_image, image, event.camera) except Exception as ex: logger.exception(ex) return JSONResponse( @@ -1140,7 +1141,8 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N box = event.data["box"] try: - request.app.frigate_config.plus_api.add_annotation( + await asyncio.to_thread( + request.app.frigate_config.plus_api.add_annotation, event.plus_id, box, event.label,