Adjust sleep intervals to avoid trips without realtime data expiring

This commit is contained in:
Christopher Teutsch 2019-05-15 21:54:52 +02:00
parent aacbdb8450
commit 16cbc23c1a
Signed by: iwonder
GPG Key ID: 0EE33D788D50130D

View File

@ -147,6 +147,8 @@ def get_next_refresh(data: dict):
times.sort() times.sort()
for time in times: for time in times:
if (datetime.datetime.fromtimestamp(time) - datetime.datetime.now()) > datetime.timedelta(seconds=30): if (datetime.datetime.fromtimestamp(time) - datetime.datetime.now()) > datetime.timedelta(seconds=30):
if (datetime.datetime.fromtimestamp(time)-datetime.datetime.now()) > datetime.timedelta(minutes=5):
return (datetime.datetime.now()+datetime.timedelta(minutes=5)).timestamp()
return time return time
return (datetime.datetime.now() + datetime.timedelta(seconds=60)).timestamp() return (datetime.datetime.now() + datetime.timedelta(seconds=60)).timestamp()