forked from indymedia/epicyon
Updating of recent posts cache for events timeline
parent
8976c99310
commit
a9db0b03ab
38
inbox.py
38
inbox.py
|
@ -124,12 +124,13 @@ def inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
session, cachedWebfingers: {}, personCache: {},
|
session, cachedWebfingers: {}, personCache: {},
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
postJsonObject: {},
|
postJsonObject: {},
|
||||||
allowDeletion: bool) -> None:
|
allowDeletion: bool, boxname: str) -> None:
|
||||||
"""Converts the json post into html and stores it in a cache
|
"""Converts the json post into html and stores it in a cache
|
||||||
This enables the post to be quickly displayed later
|
This enables the post to be quickly displayed later
|
||||||
"""
|
"""
|
||||||
pageNumber = -999
|
pageNumber = -999
|
||||||
avatarUrl = None
|
avatarUrl = None
|
||||||
|
if boxname != 'tlevents' and boxname != 'outbox':
|
||||||
boxName = 'inbox'
|
boxName = 'inbox'
|
||||||
individualPostAsHtml(recentPostsCache, maxRecentPosts,
|
individualPostAsHtml(recentPostsCache, maxRecentPosts,
|
||||||
getIconsDir(baseDir), translate, pageNumber,
|
getIconsDir(baseDir), translate, pageNumber,
|
||||||
|
@ -2411,27 +2412,30 @@ def inboxAfterCapabilities(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
if not inboxUpdateIndex(boxname, baseDir, handle,
|
if not inboxUpdateIndex(boxname, baseDir, handle,
|
||||||
destinationFilename, debug):
|
destinationFilename, debug):
|
||||||
print('ERROR: unable to update ' + boxname + ' index')
|
print('ERROR: unable to update ' + boxname + ' index')
|
||||||
|
else:
|
||||||
|
if not unitTest:
|
||||||
|
print('Saving inbox post as html to cache')
|
||||||
|
htmlCacheStartTime = time.time()
|
||||||
|
inboxStorePostToHtmlCache(recentPostsCache,
|
||||||
|
maxRecentPosts,
|
||||||
|
translate, baseDir,
|
||||||
|
httpPrefix,
|
||||||
|
session, cachedWebfingers,
|
||||||
|
personCache,
|
||||||
|
handle.split('@')[0],
|
||||||
|
domain, port,
|
||||||
|
postJsonObject,
|
||||||
|
allowDeletion,
|
||||||
|
boxname)
|
||||||
|
timeDiff = \
|
||||||
|
str(int((time.time() - htmlCacheStartTime) * 1000))
|
||||||
|
print('Saved inbox post as html to cache in ' +
|
||||||
|
timeDiff + ' mS')
|
||||||
|
|
||||||
inboxUpdateCalendar(baseDir, handle, postJsonObject)
|
inboxUpdateCalendar(baseDir, handle, postJsonObject)
|
||||||
|
|
||||||
storeHashTags(baseDir, handle.split('@')[0], postJsonObject)
|
storeHashTags(baseDir, handle.split('@')[0], postJsonObject)
|
||||||
|
|
||||||
if not unitTest:
|
|
||||||
if debug:
|
|
||||||
print('DEBUG: saving inbox post as html to cache')
|
|
||||||
htmlCacheStartTime = time.time()
|
|
||||||
inboxStorePostToHtmlCache(recentPostsCache, maxRecentPosts,
|
|
||||||
translate, baseDir, httpPrefix,
|
|
||||||
session, cachedWebfingers,
|
|
||||||
personCache,
|
|
||||||
handle.split('@')[0], domain, port,
|
|
||||||
postJsonObject, allowDeletion)
|
|
||||||
if debug:
|
|
||||||
timeDiff = \
|
|
||||||
str(int((time.time() - htmlCacheStartTime) * 1000))
|
|
||||||
print('DEBUG: saved inbox post as html to cache in ' +
|
|
||||||
timeDiff + ' mS')
|
|
||||||
|
|
||||||
# send the post out to group members
|
# send the post out to group members
|
||||||
if isGroup:
|
if isGroup:
|
||||||
sendToGroupMembers(session, baseDir, handle, port,
|
sendToGroupMembers(session, baseDir, handle, port,
|
||||||
|
|
Loading…
Reference in New Issue