mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-30 03:44:57 +03:00
fix: run Frigate+ API calls in thread pool to prevent event loop bloc… (#22426)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
This commit is contained in:
parent
7864c446fc
commit
687fefb343
@ -1,5 +1,6 @@
|
|||||||
"""Event apis."""
|
"""Event apis."""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
@ -1124,7 +1125,9 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
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:
|
except Exception as ex:
|
||||||
logger.exception(ex)
|
logger.exception(ex)
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
@ -1140,7 +1143,8 @@ async def send_to_plus(request: Request, event_id: str, body: SubmitPlusBody = N
|
|||||||
box = event.data["box"]
|
box = event.data["box"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
request.app.frigate_config.plus_api.add_annotation(
|
await asyncio.to_thread(
|
||||||
|
request.app.frigate_config.plus_api.add_annotation,
|
||||||
event.plus_id,
|
event.plus_id,
|
||||||
box,
|
box,
|
||||||
event.label,
|
event.label,
|
||||||
@ -1230,7 +1234,8 @@ async def false_positive(request: Request, event_id: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
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,
|
event.plus_id,
|
||||||
region,
|
region,
|
||||||
box,
|
box,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user