mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
properly handle scenario with no recordings
This commit is contained in:
parent
d74021af47
commit
7d65c05994
@ -10,8 +10,7 @@ import threading
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
from peewee import JOIN, DoesNotExist
|
||||||
from peewee import JOIN
|
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import CACHE_DIR, RECORD_DIR
|
from frigate.const import CACHE_DIR, RECORD_DIR
|
||||||
@ -261,15 +260,14 @@ class RecordingCleanup(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# find all the recordings older than the oldest recording in the db
|
# find all the recordings older than the oldest recording in the db
|
||||||
|
try:
|
||||||
oldest_recording = (
|
oldest_recording = (
|
||||||
Recordings.select().order_by(Recordings.start_time.desc()).get()
|
Recordings.select().order_by(Recordings.start_time.desc()).get()
|
||||||
)
|
)
|
||||||
|
|
||||||
oldest_timestamp = (
|
oldest_timestamp = oldest_recording.start_time
|
||||||
oldest_recording.start_time
|
except DoesNotExist:
|
||||||
if oldest_recording
|
oldest_timestamp = datetime.datetime.now().timestamp()
|
||||||
else datetime.datetime.now().timestamp()
|
|
||||||
)
|
|
||||||
|
|
||||||
logger.debug(f"Oldest recording in the db: {oldest_timestamp}")
|
logger.debug(f"Oldest recording in the db: {oldest_timestamp}")
|
||||||
process = sp.run(
|
process = sp.run(
|
||||||
|
Loading…
Reference in New Issue
Block a user