Skip to content

Commit

Permalink
Fix periodic sync check (blakeblackshear#8472)
Browse files Browse the repository at this point in the history
* Fix periodic sync

* Formatting
  • Loading branch information
NickM-27 committed Nov 5, 2023
1 parent 65e3e67 commit 14c89c9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions frigate/record/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,12 @@ def delete_files_without_db_entry(files_on_disk: list[str]):

if limited:
# get recording files from last 36 hours
hour_check = (
datetime.datetime.now().astimezone(datetime.timezone.utc)
- datetime.timedelta(hours=36)
).strftime("%Y-%m-%d/%H")
hour_check = f"{RECORD_DIR}/{(datetime.datetime.now().astimezone(datetime.timezone.utc) - datetime.timedelta(hours=36)).strftime('%Y-%m-%d/%H')}"
files_on_disk = {
os.path.join(root, file)
for root, _, files in os.walk(RECORD_DIR)
for file in files
if file > hour_check
if root > hour_check
}
else:
# get all recordings files on disk and put them in a set
Expand Down

0 comments on commit 14c89c9

Please sign in to comment.