Handle in progress previews export and fix time check bug (#14930)

* Handle in progress previews and fix time check bug

* Formatting
This commit is contained in:
Nicolas Mowen
2024-11-11 09:30:55 -06:00
committed by GitHub
parent 6c86827d3a
commit 9c20cd5f7b
4 changed files with 44 additions and 2 deletions
+11
View File
@@ -282,6 +282,17 @@ def get_tomorrow_at_time(hour: int) -> datetime.datetime:
)
def is_current_hour(timestamp: int) -> bool:
"""Returns if timestamp is in the current UTC hour."""
start_of_next_hour = (
datetime.datetime.now(datetime.timezone.utc).replace(
minute=0, second=0, microsecond=0
)
+ datetime.timedelta(hours=1)
).timestamp()
return timestamp < start_of_next_hour
def clear_and_unlink(file: Path, missing_ok: bool = True) -> None:
"""clear file then unlink to avoid space retained by file descriptors."""
if not missing_ok and not file.exists():