Handle clock resets

main
Bob Mottram 2021-06-21 10:40:43 +01:00
parent 9cb89aea90
commit 727ba3da6f
1 changed files with 3 additions and 0 deletions

View File

@ -175,6 +175,9 @@ def updateBlockedCache(baseDir: str,
"""Updates the cache of globally blocked domains held in memory
"""
currTime = int(time.time())
if blockedCacheLastUpdated > currTime:
print('WARN: Cache updated in the future')
blockedCacheLastUpdated = 0
secondsSinceLastUpdate = currTime - blockedCacheLastUpdated
if secondsSinceLastUpdate < blockedCacheUpdateSecs:
return blockedCacheLastUpdated