Periodically sync for stale recordings (#8433)

* Periodically cleanup recordings files / DB

* Make automatic sync limited ot last 36 hours
This commit is contained in:
Nicolas Mowen
2023-11-03 20:21:29 -06:00
committed by GitHub
parent 4f7b710112
commit 63233a5830
4 changed files with 133 additions and 69 deletions

View File

@@ -263,8 +263,9 @@ def find_by_key(dictionary, target_key):
return None
def get_tomorrow_at_2() -> datetime.datetime:
def get_tomorrow_at_time(hour: int) -> datetime.datetime:
"""Returns the datetime of the following day at 2am."""
tomorrow = datetime.datetime.now(get_localzone()) + datetime.timedelta(days=1)
return tomorrow.replace(hour=2, minute=0, second=0).astimezone(
return tomorrow.replace(hour=hour, minute=0, second=0).astimezone(
datetime.timezone.utc
)