diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index c3496f9ea..b0c964507 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -350,8 +350,8 @@ record: # Optional: Number of minutes to wait between cleanup runs (default: shown below) # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o expire_interval: 60 - # Optional: Sync recordings with disk on startup (default: shown below). - sync_on_startup: False + # Optional: Sync recordings with disk on startup and once a day (default: shown below). + sync_recordings: False # Optional: Retention settings for recording retain: # Optional: Number of days to retain recordings regardless of events (default: shown below) diff --git a/docs/docs/configuration/record.md b/docs/docs/configuration/record.md index a4739fa3b..5a505c6d1 100644 --- a/docs/docs/configuration/record.md +++ b/docs/docs/configuration/record.md @@ -87,11 +87,11 @@ The export page in the Frigate WebUI allows for exporting real time clips with a ## Syncing Recordings With Disk -In some cases the recordings files may be deleted but Frigate will not know this has happened. Sync on startup can be enabled which will tell Frigate to check the file system and delete any db entries for files which don't exist. +In some cases the recordings files may be deleted but Frigate will not know this has happened. Recordings sync can be enabled which will tell Frigate to check the file system and delete any db entries for files which don't exist. ```yaml record: - sync_on_startup: True + sync_recordings: True ``` :::warning diff --git a/frigate/config.py b/frigate/config.py index a7ceaeecb..4c0db2441 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -259,8 +259,8 @@ class RecordExportConfig(FrigateBaseModel): class RecordConfig(FrigateBaseModel): enabled: bool = Field(default=False, title="Enable record on all cameras.") - sync_on_startup: bool = Field( - default=False, title="Sync recordings with disk on startup." + sync_recordings: bool = Field( + default=False, title="Sync recordings with disk on startup and once a day." ) expire_interval: int = Field( default=60, diff --git a/frigate/record/cleanup.py b/frigate/record/cleanup.py index 7b3bc7e8d..c7aa0e167 100644 --- a/frigate/record/cleanup.py +++ b/frigate/record/cleanup.py @@ -176,10 +176,9 @@ class RecordingCleanup(threading.Thread): def run(self) -> None: # on startup sync recordings with disk if enabled - if self.config.record.sync_on_startup: + if self.config.record.sync_recordings: sync_recordings(limited=False) - - next_sync = get_tomorrow_at_time(3) + next_sync = get_tomorrow_at_time(3) # Expire tmp clips every minute, recordings and clean directories every hour. for counter in itertools.cycle(range(self.config.record.expire_interval)): @@ -189,7 +188,11 @@ class RecordingCleanup(threading.Thread): self.clean_tmp_clips() - if datetime.datetime.now().astimezone(datetime.timezone.utc) > next_sync: + if ( + self.config.record.sync_recordings + and datetime.datetime.now().astimezone(datetime.timezone.utc) + > next_sync + ): sync_recordings(limited=True) next_sync = get_tomorrow_at_time(3)