mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-19 23:08:08 +02:00
fix: run Frigate+ API calls in thread pool to prevent event loop bloc… (#22426)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Event apis."""
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import datetime
|
||||
import json
|
||||
@@ -1124,7 +1125,9 @@ 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 +1143,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,
|
||||
@@ -1230,7 +1234,8 @@ async def false_positive(request: Request, event_id: str):
|
||||
)
|
||||
|
||||
try:
|
||||
request.app.frigate_config.plus_api.add_false_positive(
|
||||
await asyncio.to_thread(
|
||||
request.app.frigate_config.plus_api.add_false_positive,
|
||||
event.plus_id,
|
||||
region,
|
||||
box,
|
||||
|
||||
Reference in New Issue
Block a user