Extra POST benchmarks

main
Bob Mottram 2019-11-16 10:40:35 +00:00
parent 5b7cebc46d
commit a69c2f2bd9
1 changed files with 40 additions and 0 deletions

View File

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