Minutes difference

merge-requests/30/head
Bob Mottram 2021-10-20 15:20:27 +01:00
parent b4e4159e8b
commit 732b8efc97
2 changed files with 8 additions and 1 deletions

View File

@ -161,7 +161,7 @@ def _updateCachedHashtagSwarm(baseDir: str, nickname: str, domain: str,
if modifiedDate:
currDate = datetime.datetime.utcnow()
timeDiff = currDate - modifiedDate
diffMins = divmod(timeDiff.total_seconds(), 60)
diffMins = int(timeDiff.total_seconds() / 60)
if diffMins < 10:
# was saved recently, so don't save again
# This avoids too much disk I/O

View File

@ -432,6 +432,13 @@ def htmlSearch(cssCache: {}, translate: {},
pass
if not swarmStr:
swarmStr = htmlHashTagSwarm(baseDir, actor, translate)
if swarmStr:
try:
with open(cachedHashtagSwarmFilename, 'w+') as fp:
fp.write(swarmStr)
except BaseException:
print('WARN: Unable to save cached hashtag swarm')
pass
followStr += ' <p class="hashtagswarm">' + swarmStr + '</p>\n'
followStr += ' </center>\n'