10 lines
284 B
Python
10 lines
284 B
Python
from datetime import datetime
|
|
|
|
RUN_HOUR = 3
|
|
|
|
|
|
def should_run(now: datetime, last_run_ts: float | None, startup: bool) -> bool:
|
|
if last_run_ts is not None and datetime.fromtimestamp(last_run_ts).date() == now.date():
|
|
return False
|
|
return startup or now.hour >= RUN_HOUR
|