mirror of https://gitlab.com/bashrc2/epicyon
Tidying of logging
parent
fc636182ac
commit
e03a03e548
227
webapp_post.py
227
webapp_post.py
|
@ -145,23 +145,13 @@ def getPostFromRecentCache(session,
|
||||||
getPersonAvatarUrl(baseDir, postActor, personCache,
|
getPersonAvatarUrl(baseDir, postActor, personCache,
|
||||||
allowDownloads)
|
allowDownloads)
|
||||||
|
|
||||||
# benchmark 2.1
|
logPostTiming(enableTimingLog, postStartTime, '2.1')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 2.1 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
updateAvatarImageCache(session, baseDir, httpPrefix,
|
updateAvatarImageCache(session, baseDir, httpPrefix,
|
||||||
postActor, avatarUrl, personCache,
|
postActor, avatarUrl, personCache,
|
||||||
allowDownloads)
|
allowDownloads)
|
||||||
|
|
||||||
# benchmark 2.2
|
logPostTiming(enableTimingLog, postStartTime, '2.2')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 2.2 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
postHtml = \
|
postHtml = \
|
||||||
loadIndividualPostAsHtmlFromCache(baseDir, nickname, domain,
|
loadIndividualPostAsHtmlFromCache(baseDir, nickname, domain,
|
||||||
|
@ -172,12 +162,7 @@ def getPostFromRecentCache(session,
|
||||||
postHtml = preparePostFromHtmlCache(postHtml, boxName, pageNumber)
|
postHtml = preparePostFromHtmlCache(postHtml, boxName, pageNumber)
|
||||||
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
||||||
postJsonObject, postHtml)
|
postJsonObject, postHtml)
|
||||||
# benchmark 3
|
logPostTiming(enableTimingLog, postStartTime, '3')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 3 = ' + str(timeDiff))
|
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,11 +402,7 @@ def getLikeIconHtml(nickname: str, domainFull: str,
|
||||||
likeTitle = translate['Like this post']
|
likeTitle = translate['Like this post']
|
||||||
likeCount = noOfLikes(postJsonObject)
|
likeCount = noOfLikes(postJsonObject)
|
||||||
|
|
||||||
# benchmark 12.1
|
logPostTiming(enableTimingLog, postStartTime, '12.1')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12.1 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
likeCountStr = ''
|
likeCountStr = ''
|
||||||
if likeCount > 0:
|
if likeCount > 0:
|
||||||
|
@ -437,11 +418,7 @@ def getLikeIconHtml(nickname: str, domainFull: str,
|
||||||
likeLink = 'unlike'
|
likeLink = 'unlike'
|
||||||
likeTitle = translate['Undo the like']
|
likeTitle = translate['Undo the like']
|
||||||
|
|
||||||
# benchmark 12.2
|
logPostTiming(enableTimingLog, postStartTime, '12.2')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12.2 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
likeStr = ''
|
likeStr = ''
|
||||||
if likeCountStr:
|
if likeCountStr:
|
||||||
|
@ -488,11 +465,7 @@ def getBookmarkIconHtml(nickname: str, domainFull: str,
|
||||||
bookmarkIcon = 'bookmark.png'
|
bookmarkIcon = 'bookmark.png'
|
||||||
bookmarkLink = 'unbookmark'
|
bookmarkLink = 'unbookmark'
|
||||||
bookmarkTitle = translate['Undo the bookmark']
|
bookmarkTitle = translate['Undo the bookmark']
|
||||||
# benchmark 12.6
|
logPostTiming(enableTimingLog, postStartTime, '12.6')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff))
|
|
||||||
bookmarkStr = \
|
bookmarkStr = \
|
||||||
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
||||||
bookmarkLink + '=' + postJsonObject['object']['id'] + \
|
bookmarkLink + '=' + postJsonObject['object']['id'] + \
|
||||||
|
@ -742,12 +715,7 @@ def getPostTitleAnnounceHtml(baseDir: str,
|
||||||
titleStr += boostOwnTootHtml(translate, iconsPath)
|
titleStr += boostOwnTootHtml(translate, iconsPath)
|
||||||
else:
|
else:
|
||||||
# boosting another person's post
|
# boosting another person's post
|
||||||
# benchmark 13.2
|
logPostTiming(enableTimingLog, postStartTime, '13.2')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.2 = ' + str(timeDiff))
|
|
||||||
announceNickname = None
|
announceNickname = None
|
||||||
if attributedTo:
|
if attributedTo:
|
||||||
announceNickname = getNicknameFromActor(attributedTo)
|
announceNickname = getNicknameFromActor(attributedTo)
|
||||||
|
@ -759,13 +727,7 @@ def getPostTitleAnnounceHtml(baseDir: str,
|
||||||
announceDisplayName = \
|
announceDisplayName = \
|
||||||
getDisplayName(baseDir, attributedTo, personCache)
|
getDisplayName(baseDir, attributedTo, personCache)
|
||||||
if announceDisplayName:
|
if announceDisplayName:
|
||||||
# benchmark 13.3
|
logPostTiming(enableTimingLog, postStartTime, '13.3')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = \
|
|
||||||
int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.3 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# add any emoji to the display name
|
# add any emoji to the display name
|
||||||
if ':' in announceDisplayName:
|
if ':' in announceDisplayName:
|
||||||
|
@ -774,14 +736,7 @@ def getPostTitleAnnounceHtml(baseDir: str,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
announceDisplayName,
|
announceDisplayName,
|
||||||
False)
|
False)
|
||||||
# benchmark 13.3.1
|
logPostTiming(enableTimingLog, postStartTime, '13.3.1')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = \
|
|
||||||
int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.3.1 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
titleStr += \
|
titleStr += \
|
||||||
announceWithDisplayNameHtml(translate,
|
announceWithDisplayNameHtml(translate,
|
||||||
iconsPath,
|
iconsPath,
|
||||||
|
@ -794,13 +749,7 @@ def getPostTitleAnnounceHtml(baseDir: str,
|
||||||
getPersonAvatarUrl(baseDir, announceActor,
|
getPersonAvatarUrl(baseDir, announceActor,
|
||||||
personCache, allowDownloads)
|
personCache, allowDownloads)
|
||||||
|
|
||||||
# benchmark 13.4
|
logPostTiming(enableTimingLog, postStartTime, '13.4')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = \
|
|
||||||
int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.4 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if announceAvatarUrl:
|
if announceAvatarUrl:
|
||||||
idx = 'Show options for this person'
|
idx = 'Show options for this person'
|
||||||
|
@ -897,6 +846,14 @@ def getReplyHtml(translate: {}, iconsPath: str,
|
||||||
replyDisplayName + '</a>\n'
|
replyDisplayName + '</a>\n'
|
||||||
|
|
||||||
|
|
||||||
|
def logPostTiming(enableTimingLog: bool, postStartTime, debugId: str) -> None:
|
||||||
|
if not enableTimingLog:
|
||||||
|
return
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMING INDIV ' + debugId + ' = ' + str(timeDiff))
|
||||||
|
|
||||||
|
|
||||||
def getPostTitleReplyHtml(baseDir: str,
|
def getPostTitleReplyHtml(baseDir: str,
|
||||||
httpPrefix: str,
|
httpPrefix: str,
|
||||||
nickname: str, domain: str,
|
nickname: str, domain: str,
|
||||||
|
@ -950,14 +907,8 @@ def getPostTitleReplyHtml(baseDir: str,
|
||||||
if replyDisplayName:
|
if replyDisplayName:
|
||||||
# add emoji to the display name
|
# add emoji to the display name
|
||||||
if ':' in replyDisplayName:
|
if ':' in replyDisplayName:
|
||||||
# benchmark 13.5
|
logPostTiming(enableTimingLog, postStartTime, '13.5')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = \
|
|
||||||
int((time.time() -
|
|
||||||
postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 13.5 = ' +
|
|
||||||
str(timeDiff))
|
|
||||||
replyDisplayName = \
|
replyDisplayName = \
|
||||||
addEmojiToDisplayName(baseDir,
|
addEmojiToDisplayName(baseDir,
|
||||||
httpPrefix,
|
httpPrefix,
|
||||||
|
@ -965,26 +916,13 @@ def getPostTitleReplyHtml(baseDir: str,
|
||||||
domain,
|
domain,
|
||||||
replyDisplayName,
|
replyDisplayName,
|
||||||
False)
|
False)
|
||||||
# benchmark 13.6
|
logPostTiming(enableTimingLog, postStartTime, '13.6')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = \
|
|
||||||
int((time.time() -
|
|
||||||
postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 13.6 = ' +
|
|
||||||
str(timeDiff))
|
|
||||||
|
|
||||||
titleStr += \
|
titleStr += \
|
||||||
getReplyHtml(translate, iconsPath,
|
getReplyHtml(translate, iconsPath,
|
||||||
inReplyTo, replyDisplayName)
|
inReplyTo, replyDisplayName)
|
||||||
|
|
||||||
# benchmark 13.7
|
logPostTiming(enableTimingLog, postStartTime, '13.7')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() -
|
|
||||||
postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.7 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# show avatar of person replied to
|
# show avatar of person replied to
|
||||||
replyAvatarUrl = \
|
replyAvatarUrl = \
|
||||||
|
@ -993,13 +931,7 @@ def getPostTitleReplyHtml(baseDir: str,
|
||||||
personCache,
|
personCache,
|
||||||
allowDownloads)
|
allowDownloads)
|
||||||
|
|
||||||
# benchmark 13.8
|
logPostTiming(enableTimingLog, postStartTime, '13.8')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() -
|
|
||||||
postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName +
|
|
||||||
' 13.8 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if replyAvatarUrl:
|
if replyAvatarUrl:
|
||||||
replyAvatarImageInPost = \
|
replyAvatarImageInPost = \
|
||||||
|
@ -1215,11 +1147,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
if postHtml:
|
if postHtml:
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
# benchmark 4
|
logPostTiming(enableTimingLog, postStartTime, '4')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 4 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
getAvatarImageUrl(session,
|
getAvatarImageUrl(session,
|
||||||
|
@ -1227,11 +1155,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
postActor, personCache,
|
postActor, personCache,
|
||||||
avatarUrl, allowDownloads)
|
avatarUrl, allowDownloads)
|
||||||
|
|
||||||
# benchmark 5
|
logPostTiming(enableTimingLog, postStartTime, '5')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 5 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# get the display name
|
# get the display name
|
||||||
if domainFull not in postActor:
|
if domainFull not in postActor:
|
||||||
|
@ -1241,11 +1165,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
personCache,
|
personCache,
|
||||||
projectVersion, httpPrefix,
|
projectVersion, httpPrefix,
|
||||||
nickname, domain, 'outbox')
|
nickname, domain, 'outbox')
|
||||||
# benchmark 6
|
logPostTiming(enableTimingLog, postStartTime, '6')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 6 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if avatarUrl2:
|
if avatarUrl2:
|
||||||
avatarUrl = avatarUrl2
|
avatarUrl = avatarUrl2
|
||||||
|
@ -1257,11 +1177,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
displayName, False)
|
displayName, False)
|
||||||
|
|
||||||
# benchmark 7
|
logPostTiming(enableTimingLog, postStartTime, '7')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 7 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
avatarLink = \
|
avatarLink = \
|
||||||
getAvatarImageHtml(showAvatarOptions,
|
getAvatarImageHtml(showAvatarOptions,
|
||||||
|
@ -1308,11 +1224,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
postJsonObject = postJsonAnnounce
|
postJsonObject = postJsonAnnounce
|
||||||
isAnnounced = True
|
isAnnounced = True
|
||||||
|
|
||||||
# benchmark 8
|
logPostTiming(enableTimingLog, postStartTime, '8')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 8 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if not isinstance(postJsonObject['object'], dict):
|
if not isinstance(postJsonObject['object'], dict):
|
||||||
return ''
|
return ''
|
||||||
|
@ -1363,10 +1275,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
'">@' + actorNickname + '@' + actorDomain + '</a>\n'
|
'">@' + actorNickname + '@' + actorDomain + '</a>\n'
|
||||||
|
|
||||||
# benchmark 9
|
# benchmark 9
|
||||||
if enableTimingLog:
|
logPostTiming(enableTimingLog, postStartTime, '9')
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 9 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# Show a DM icon for DMs in the inbox timeline
|
# Show a DM icon for DMs in the inbox timeline
|
||||||
if showDMicon:
|
if showDMicon:
|
||||||
|
@ -1385,19 +1294,11 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
postJsonObject, pageNumberParam,
|
postJsonObject, pageNumberParam,
|
||||||
iconsPath, translate)
|
iconsPath, translate)
|
||||||
|
|
||||||
# benchmark 10
|
logPostTiming(enableTimingLog, postStartTime, '10')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 10 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
isEvent = isEventPost(postJsonObject)
|
isEvent = isEventPost(postJsonObject)
|
||||||
|
|
||||||
# benchmark 11
|
logPostTiming(enableTimingLog, postStartTime, '11')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 11 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
editStr = getEditIconHtml(baseDir, nickname, domainFull,
|
editStr = getEditIconHtml(baseDir, nickname, domainFull,
|
||||||
postJsonObject, actorNickname,
|
postJsonObject, actorNickname,
|
||||||
|
@ -1414,11 +1315,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
timelinePostBookmark,
|
timelinePostBookmark,
|
||||||
boxName, iconsPath)
|
boxName, iconsPath)
|
||||||
|
|
||||||
# benchmark 12
|
logPostTiming(enableTimingLog, postStartTime, '12')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# whether to show a like button
|
# whether to show a like button
|
||||||
hideLikeButtonFile = \
|
hideLikeButtonFile = \
|
||||||
|
@ -1437,11 +1334,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
timelinePostBookmark,
|
timelinePostBookmark,
|
||||||
boxName, iconsPath)
|
boxName, iconsPath)
|
||||||
|
|
||||||
# benchmark 12.5
|
logPostTiming(enableTimingLog, postStartTime, '12.5')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12.5 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
bookmarkStr = \
|
bookmarkStr = \
|
||||||
getBookmarkIconHtml(nickname, domainFull,
|
getBookmarkIconHtml(nickname, domainFull,
|
||||||
|
@ -1454,19 +1347,11 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
timelinePostBookmark,
|
timelinePostBookmark,
|
||||||
iconsPath)
|
iconsPath)
|
||||||
|
|
||||||
# benchmark 12.9
|
logPostTiming(enableTimingLog, postStartTime, '12.9')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 12.9 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId)
|
isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId)
|
||||||
|
|
||||||
# benchmark 13
|
logPostTiming(enableTimingLog, postStartTime, '13')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 13 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
muteStr = \
|
muteStr = \
|
||||||
getMuteIconHtml(isMuted,
|
getMuteIconHtml(isMuted,
|
||||||
|
@ -1490,11 +1375,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
iconsPath,
|
iconsPath,
|
||||||
translate)
|
translate)
|
||||||
|
|
||||||
# benchmark 13.1
|
logPostTiming(enableTimingLog, postStartTime, '13.1')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 13.1 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# get the title: x replies to y, x announces y, etc
|
# get the title: x replies to y, x announces y, etc
|
||||||
(titleStr2,
|
(titleStr2,
|
||||||
|
@ -1521,11 +1402,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
containerClass)
|
containerClass)
|
||||||
titleStr += titleStr2
|
titleStr += titleStr2
|
||||||
|
|
||||||
# benchmark 14
|
logPostTiming(enableTimingLog, postStartTime, '14')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 14 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
attachmentStr, galleryStr = \
|
attachmentStr, galleryStr = \
|
||||||
getPostAttachmentsAsHtml(postJsonObject, boxName, translate,
|
getPostAttachmentsAsHtml(postJsonObject, boxName, translate,
|
||||||
|
@ -1536,11 +1413,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
publishedStr = \
|
publishedStr = \
|
||||||
getPublishedDateStr(postJsonObject, showPublishedDateOnly)
|
getPublishedDateStr(postJsonObject, showPublishedDateOnly)
|
||||||
|
|
||||||
# benchmark 15
|
logPostTiming(enableTimingLog, postStartTime, '15')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 15 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
publishedLink = messageId
|
publishedLink = messageId
|
||||||
# blog posts should have no /statuses/ in their link
|
# blog posts should have no /statuses/ in their link
|
||||||
|
@ -1611,11 +1484,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
postJsonObject['object']['summary'],
|
postJsonObject['object']['summary'],
|
||||||
postJsonObject['object']['content'])
|
postJsonObject['object']['content'])
|
||||||
|
|
||||||
# benchmark 16
|
logPostTiming(enableTimingLog, postStartTime, '16')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 16 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if not isPatch:
|
if not isPatch:
|
||||||
objectContent = \
|
objectContent = \
|
||||||
|
@ -1658,11 +1527,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
else:
|
else:
|
||||||
contentStr += cwContentStr
|
contentStr += cwContentStr
|
||||||
|
|
||||||
# benchmark 17
|
logPostTiming(enableTimingLog, postStartTime, '17')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 17 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
if postJsonObject['object'].get('tag') and not isPatch:
|
if postJsonObject['object'].get('tag') and not isPatch:
|
||||||
contentStr = \
|
contentStr = \
|
||||||
|
@ -1699,11 +1564,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
else:
|
else:
|
||||||
postHtml = galleryStr
|
postHtml = galleryStr
|
||||||
|
|
||||||
# benchmark 18
|
logPostTiming(enableTimingLog, postStartTime, '18')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 18 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
# save the created html to the recent posts cache
|
# save the created html to the recent posts cache
|
||||||
if not showPublicOnly and storeToCache and \
|
if not showPublicOnly and storeToCache and \
|
||||||
|
@ -1714,11 +1575,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
||||||
postJsonObject, postHtml)
|
postJsonObject, postHtml)
|
||||||
|
|
||||||
# benchmark 19
|
logPostTiming(enableTimingLog, postStartTime, '19')
|
||||||
if enableTimingLog:
|
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
|
||||||
if timeDiff > 100:
|
|
||||||
print('TIMING INDIV ' + boxName + ' 19 = ' + str(timeDiff))
|
|
||||||
|
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue