mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Bugfix: SqliteQueueDatabase instead of SqliteDatabase and retry_interval for fetching latest frame in http.py (#7059)
* Refactor http.py to use SqliteQueueDatabase instead of SqliteDatabase and add retry interval for fetching latest frame * isort && black
This commit is contained in:
parent
baf671b764
commit
cbb77e5794
@ -24,8 +24,9 @@ from flask import (
|
|||||||
make_response,
|
make_response,
|
||||||
request,
|
request,
|
||||||
)
|
)
|
||||||
from peewee import DoesNotExist, SqliteDatabase, fn, operator
|
from peewee import DoesNotExist, fn, operator
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
from tzlocal import get_localzone_name
|
from tzlocal import get_localzone_name
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
@ -49,7 +50,7 @@ bp = Blueprint("frigate", __name__)
|
|||||||
|
|
||||||
def create_app(
|
def create_app(
|
||||||
frigate_config,
|
frigate_config,
|
||||||
database: SqliteDatabase,
|
database: SqliteQueueDatabase,
|
||||||
stats_tracking,
|
stats_tracking,
|
||||||
detected_frames_processor,
|
detected_frames_processor,
|
||||||
storage_maintainer: StorageMaintainer,
|
storage_maintainer: StorageMaintainer,
|
||||||
@ -1099,10 +1100,14 @@ def latest_frame(camera_name):
|
|||||||
frame = current_app.detected_frames_processor.get_current_frame(
|
frame = current_app.detected_frames_processor.get_current_frame(
|
||||||
camera_name, draw_options
|
camera_name, draw_options
|
||||||
)
|
)
|
||||||
|
retry_interval = float(
|
||||||
|
current_app.frigate_config.cameras.get(camera_name).ffmpeg.retry_interval
|
||||||
|
or 10
|
||||||
|
)
|
||||||
|
|
||||||
if frame is None or datetime.now().timestamp() > (
|
if frame is None or datetime.now().timestamp() > (
|
||||||
current_app.detected_frames_processor.get_current_frame_time(camera_name)
|
current_app.detected_frames_processor.get_current_frame_time(camera_name)
|
||||||
+ 10
|
+ retry_interval
|
||||||
):
|
):
|
||||||
if current_app.camera_error_image is None:
|
if current_app.camera_error_image is None:
|
||||||
error_image = glob.glob("/opt/frigate/frigate/images/camera-error.jpg")
|
error_image = glob.glob("/opt/frigate/frigate/images/camera-error.jpg")
|
||||||
|
Loading…
Reference in New Issue
Block a user