Performance monitoring of like button

main
Bob Mottram 2021-10-20 19:41:43 +01:00
parent 549ddab68c
commit 31dbf14cfd
1 changed files with 27 additions and 0 deletions

View File

@ -7348,6 +7348,9 @@ class PubServer(BaseHTTPRequestHandler):
self._redirect_headers(actorPathStr, cookie, self._redirect_headers(actorPathStr, cookie,
callingDomain) callingDomain)
return return
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton1',
self.server.debug)
if not self.server.session: if not self.server.session:
print('Starting new session during like') print('Starting new session during like')
self.server.session = createSession(proxyType) self.server.session = createSession(proxyType)
@ -7356,6 +7359,9 @@ class PubServer(BaseHTTPRequestHandler):
self._404() self._404()
self.server.GETbusy = False self.server.GETbusy = False
return return
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton2',
self.server.debug)
likeActor = \ likeActor = \
localActorUrl(httpPrefix, self.postToNickname, domainFull) localActorUrl(httpPrefix, self.postToNickname, domainFull)
actorLiked = path.split('?actor=')[1] actorLiked = path.split('?actor=')[1]
@ -7366,6 +7372,9 @@ class PubServer(BaseHTTPRequestHandler):
origActor, origPostUrl, origFilename = \ origActor, origPostUrl, origFilename = \
getOriginalPostFromAnnounceUrl(likeUrl, baseDir, getOriginalPostFromAnnounceUrl(likeUrl, baseDir,
self.postToNickname, domain) self.postToNickname, domain)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton3',
self.server.debug)
likeUrl2 = likeUrl likeUrl2 = likeUrl
likedPostFilename = origFilename likedPostFilename = origFilename
if origActor and origPostUrl: if origActor and origPostUrl:
@ -7383,6 +7392,9 @@ class PubServer(BaseHTTPRequestHandler):
# send out the like to followers # send out the like to followers
self._postToOutbox(likeJson, self.server.projectVersion, None) self._postToOutbox(likeJson, self.server.projectVersion, None)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton4',
self.server.debug)
print('Locating liked post ' + likeUrl) print('Locating liked post ' + likeUrl)
# directly like the post file # directly like the post file
@ -7390,6 +7402,9 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = \ likedPostFilename = \
locatePost(baseDir, self.postToNickname, domain, likeUrl) locatePost(baseDir, self.postToNickname, domain, likeUrl)
if likedPostFilename: if likedPostFilename:
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton5',
self.server.debug)
recentPostsCache = self.server.recentPostsCache recentPostsCache = self.server.recentPostsCache
likedPostJson = loadJson(likedPostFilename, 0, 1) likedPostJson = loadJson(likedPostFilename, 0, 1)
if origFilename and origPostUrl: if origFilename and origPostUrl:
@ -7401,6 +7416,9 @@ class PubServer(BaseHTTPRequestHandler):
likedPostFilename = origFilename likedPostFilename = origFilename
if debug: if debug:
print('Updating likes for ' + likedPostFilename) print('Updating likes for ' + likedPostFilename)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton6',
self.server.debug)
updateLikesCollection(recentPostsCache, updateLikesCollection(recentPostsCache,
baseDir, likedPostFilename, likeUrl, baseDir, likedPostFilename, likeUrl,
likeActor, self.postToNickname, domain, likeActor, self.postToNickname, domain,
@ -7409,6 +7427,9 @@ class PubServer(BaseHTTPRequestHandler):
print('Regenerating html post for changed likes collection') print('Regenerating html post for changed likes collection')
# clear the icon from the cache so that it gets updated # clear the icon from the cache so that it gets updated
if likedPostJson: if likedPostJson:
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton6',
self.server.debug)
cachedPostFilename = \ cachedPostFilename = \
getCachedPostFilename(baseDir, self.postToNickname, getCachedPostFilename(baseDir, self.postToNickname,
domain, likedPostJson) domain, likedPostJson)
@ -7422,6 +7443,9 @@ class PubServer(BaseHTTPRequestHandler):
followerApprovalActive(baseDir, followerApprovalActive(baseDir,
self.postToNickname, domain) self.postToNickname, domain)
showRepeats = not isDM(likedPostJson) showRepeats = not isDM(likedPostJson)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton7',
self.server.debug)
individualPostAsHtml(self.server.signingPrivateKeyPem, False, individualPostAsHtml(self.server.signingPrivateKeyPem, False,
self.server.recentPostsCache, self.server.recentPostsCache,
self.server.maxRecentPosts, self.server.maxRecentPosts,
@ -7449,6 +7473,9 @@ class PubServer(BaseHTTPRequestHandler):
showIndividualPostIcons, showIndividualPostIcons,
manuallyApproveFollowers, manuallyApproveFollowers,
False, True, False) False, True, False)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', '_likeButton8',
self.server.debug)
else: else:
print('WARN: Liked post not found: ' + likedPostFilename) print('WARN: Liked post not found: ' + likedPostFilename)
# clear the icon from the cache so that it gets updated # clear the icon from the cache so that it gets updated