Clearing cache when new like is received

main
Bob Mottram 2021-05-19 20:35:07 +01:00
parent ede2162d7c
commit bbde34144f
4 changed files with 10 additions and 7 deletions

View File

@ -6721,7 +6721,8 @@ class PubServer(BaseHTTPRequestHandler):
updateLikesCollection(self.server.recentPostsCache,
baseDir,
likedPostFilename, likeUrl,
likeActor, domain,
likeActor,
self.postToNickname, domain,
debug)
# clear the icon from the cache so that it gets updated
if self.server.iconsCache.get('like.png'):

View File

@ -1010,7 +1010,8 @@ def _receiveLike(recentPostsCache: {},
_likeNotify(baseDir, domain, onionDomain, handle,
messageJson['actor'], postLikedId)
updateLikesCollection(recentPostsCache, baseDir, postFilename,
postLikedId, messageJson['actor'], domain, debug)
postLikedId, messageJson['actor'],
handleName, domain, debug)
return True

View File

@ -103,7 +103,8 @@ def _like(recentPostsCache: {},
updateLikesCollection(recentPostsCache,
baseDir, postFilename, objectUrl,
newLikeJson['actor'], domain, debug)
newLikeJson['actor'],
nickname, domain, debug)
sendSignedJson(newLikeJson, session, baseDir,
nickname, domain, port,
@ -334,7 +335,8 @@ def outboxLike(recentPostsCache: {},
return True
updateLikesCollection(recentPostsCache,
baseDir, postFilename, messageId,
messageJson['actor'], domain, debug)
messageJson['actor'],
nickname, domain, debug)
if debug:
print('DEBUG: post liked via c2s - ' + postFilename)

View File

@ -1886,8 +1886,8 @@ def undoLikesCollectionEntry(recentPostsCache: {},
def updateLikesCollection(recentPostsCache: {},
baseDir: str, postFilename: str,
objectUrl: str,
actor: str, domain: str, debug: bool) -> None:
objectUrl: str, actor: str,
nickname: str, domain: str, debug: bool) -> None:
"""Updates the likes collection within a post
"""
postJsonObject = loadJson(postFilename)
@ -1896,7 +1896,6 @@ def updateLikesCollection(recentPostsCache: {},
# remove any cached version of this post so that the
# like icon is changed
removePostFromCache(postJsonObject, recentPostsCache)
nickname = getNicknameFromActor(actor)
cachedPostFilename = getCachedPostFilename(baseDir, nickname,
domain, postJsonObject)
if cachedPostFilename: