From a69c2f2bd9ab33d431873f1389125bc0d0ccc900 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 16 Nov 2019 10:40:35 +0000 Subject: [PATCH] Extra POST benchmarks --- daemon.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/daemon.py b/daemon.py index a425ff35..e4224ad9 100644 --- a/daemon.py +++ b/daemon.py @@ -3296,6 +3296,8 @@ class PubServer(BaseHTTPRequestHandler): self.outboxAuthenticated=False self.postToNickname=None + self._benchmarkPOST(POSTstartTime,111) + if self.path.startswith('/login'): # get the contents of POST containing login credentials length = int(self.headers['Content-length']) @@ -3390,6 +3392,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,8) return + self._benchmarkPOST(POSTstartTime,222) + # update of profile/avatar from web interface if authorized and self.path.endswith('/profiledata'): if ' boundary=' in self.headers['Content-type']: @@ -3697,6 +3701,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,12) return + self._benchmarkPOST(POSTstartTime,333) + # moderator action buttons if authorized and '/users/' in self.path and \ self.path.endswith('/moderationaction'): @@ -3810,6 +3816,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,15) return + self._benchmarkPOST(POSTstartTime,444) + searchForEmoji=False if self.path.endswith('/searchhandleemoji'): searchForEmoji=True @@ -3818,6 +3826,8 @@ class PubServer(BaseHTTPRequestHandler): print('DEBUG: searching for emoji') print('authorized: '+str(authorized)) + self._benchmarkPOST(POSTstartTime,444) + # a vote/question/poll is posted if authorized and \ (self.path.endswith('/question') or '/question?page=' in self.path): @@ -3883,6 +3893,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,17) return + self._benchmarkPOST(POSTstartTime,444) + # a search was made if (authorized or searchForEmoji) and \ (self.path.endswith('/searchhandle') or \ @@ -4013,6 +4025,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.POSTbusy=False return + self._benchmarkPOST(POSTstartTime,555) + # removes a shared item if authorized and self.path.endswith('/rmshare'): originPathStr=self.path.split('/rmshare')[0] @@ -4037,6 +4051,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,25) return + self._benchmarkPOST(POSTstartTime,666) + # removes a post if authorized and self.path.endswith('/rmpost'): pageNumber=1 @@ -4081,6 +4097,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,26) return + self._benchmarkPOST(POSTstartTime,777) + # decision to follow in the web interface is confirmed if authorized and self.path.endswith('/followconfirm'): originPathStr=self.path.split('/followconfirm')[0] @@ -4132,6 +4150,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,28) return + self._benchmarkPOST(POSTstartTime,888) + # decision to unfollow in the web interface is confirmed if authorized and self.path.endswith('/unfollowconfirm'): originPathStr=self.path.split('/unfollowconfirm')[0] @@ -4179,6 +4199,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,29) return + self._benchmarkPOST(POSTstartTime,999) + # decision to unblock in the web interface is confirmed if authorized and self.path.endswith('/unblockconfirm'): originPathStr=self.path.split('/unblockconfirm')[0] @@ -4225,6 +4247,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,32) return + self._benchmarkPOST(POSTstartTime,1111) + # decision to block in the web interface is confirmed if authorized and self.path.endswith('/blockconfirm'): originPathStr=self.path.split('/blockconfirm')[0] @@ -4274,6 +4298,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,35) return + self._benchmarkPOST(POSTstartTime,2222) + # an option was chosen from person options screen # view/follow/block/report if authorized and self.path.endswith('/personoptions'): @@ -4440,6 +4466,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.POSTbusy=False return + self._benchmarkPOST(POSTstartTime,3333) + pageNumber=self._receiveNewPost(authorized,'newpost',self.path) if pageNumber: nickname=self.path.split('/users/')[1] @@ -4501,6 +4529,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.POSTbusy=False return + self._benchmarkPOST(POSTstartTime,4444) + if self.path.endswith('/outbox') or self.path.endswith('/shares'): if '/users/' in self.path: if authorized: @@ -4514,6 +4544,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,53) return + self._benchmarkPOST(POSTstartTime,5555) + # check that the post is to an expected path if not (self.path.endswith('/outbox') or \ self.path.endswith('/inbox') or \ @@ -4528,6 +4560,8 @@ class PubServer(BaseHTTPRequestHandler): self._benchmarkPOST(POSTstartTime,54) return + self._benchmarkPOST(POSTstartTime,6666) + # read the message and convert it into a python dictionary length = int(self.headers['Content-length']) if self.server.debug: @@ -4617,6 +4651,8 @@ class PubServer(BaseHTTPRequestHandler): if self.server.debug: print('DEBUG: Reading message') + self._benchmarkPOST(POSTstartTime,7777) + # check content length before reading bytes if self.path == '/sharedInbox' or self.path == '/inbox': length=0 @@ -4648,6 +4684,8 @@ class PubServer(BaseHTTPRequestHandler): # convert the raw bytes to json messageJson=json.loads(messageBytes) + self._benchmarkPOST(POSTstartTime,8888) + # https://www.w3.org/TR/activitypub/#object-without-create if self.outboxAuthenticated: if self._postToOutbox(messageJson,__version__): @@ -4699,6 +4737,8 @@ class PubServer(BaseHTTPRequestHandler): if self.server.debug: pprint(messageJson) + self._benchmarkPOST(POSTstartTime,9999) + if not self.headers.get('signature'): if 'keyId=' not in self.headers['signature']: if self.server.debug: