Remove POST benchmarks

main
Bob Mottram 2019-11-16 13:06:15 +00:00
parent 2e8691f4ba
commit c0f4f502c5
1 changed files with 0 additions and 81 deletions

View File

@ -857,14 +857,6 @@ class PubServer(BaseHTTPRequestHandler):
timeDiff='0'+timeDiff timeDiff='0'+timeDiff
print('BENCHMARK GET|'+timeDiff+'|'+self.path) print('BENCHMARK GET|'+timeDiff+'|'+self.path)
def _benchmarkPOST(self,POSTstartTime,postID: int):
if self.server.debug:
timeDiff=str(int((time.time()-POSTstartTime)*1000))
timeDiffLen=len(timeDiff)
for i in range(6-timeDiffLen):
timeDiff='0'+timeDiff
print('BENCHMARK POST|'+timeDiff+'|'+self.path+'|ID'+str(postID))
def _benchmarkPOSTtimings(self,POSTstartTime,POSTtimings: [],postID: int): def _benchmarkPOSTtimings(self,POSTstartTime,POSTtimings: [],postID: int):
"""Updates a list containing how long each segment of POST takes """Updates a list containing how long each segment of POST takes
""" """
@ -3287,7 +3279,6 @@ class PubServer(BaseHTTPRequestHandler):
if currTimePOST-self.server.lastPOST==0: if currTimePOST-self.server.lastPOST==0:
self.send_response(429) self.send_response(429)
self.end_headers() self.end_headers()
self._benchmarkPOST(POSTstartTime,1)
return return
self.server.lastPOST=currTimePOST self.server.lastPOST=currTimePOST
@ -3297,7 +3288,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,2)
return return
# remove any trailing slashes from the path # remove any trailing slashes from the path
@ -3338,7 +3328,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(401) self.send_response(401)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,3)
return return
loginParams=self.rfile.read(length).decode('utf-8') loginParams=self.rfile.read(length).decode('utf-8')
loginNickname,loginPassword,register= \ loginNickname,loginPassword,register= \
@ -3353,7 +3342,6 @@ class PubServer(BaseHTTPRequestHandler):
loginNickname,loginPassword): loginNickname,loginPassword):
self.server.POSTbusy=False self.server.POSTbusy=False
self._redirect_headers('/login',cookie) self._redirect_headers('/login',cookie)
self._benchmarkPOST(POSTstartTime,4)
return return
authHeader=createBasicAuthHeader(loginNickname,loginPassword) authHeader=createBasicAuthHeader(loginNickname,loginPassword)
if not authorizeBasic(self.server.baseDir,'/users/'+ \ if not authorizeBasic(self.server.baseDir,'/users/'+ \
@ -3361,7 +3349,6 @@ class PubServer(BaseHTTPRequestHandler):
print('Login failed: '+loginNickname) print('Login failed: '+loginNickname)
self._clearLoginDetails(loginNickname) self._clearLoginDetails(loginNickname)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,5)
return return
else: else:
if isSuspended(self.server.baseDir,loginNickname): if isSuspended(self.server.baseDir,loginNickname):
@ -3369,7 +3356,6 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,6)
return return
# login success - redirect with authorization # login success - redirect with authorization
print('Login success: '+loginNickname) print('Login success: '+loginNickname)
@ -3416,12 +3402,10 @@ class PubServer(BaseHTTPRequestHandler):
self.send_header('X-Robots-Tag','noindex') self.send_header('X-Robots-Tag','noindex')
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,7)
return return
self.send_response(200) self.send_response(200)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,8)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,2) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,2)
@ -3439,14 +3423,12 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: nickname not found in '+actorStr) print('WARN: nickname not found in '+actorStr)
self._redirect_headers(actorStr,cookie) self._redirect_headers(actorStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,9)
return return
length = int(self.headers['Content-length']) length = int(self.headers['Content-length'])
if length>self.server.maxPostLength: if length>self.server.maxPostLength:
print('Maximum profile data length exceeded '+str(length)) print('Maximum profile data length exceeded '+str(length))
self._redirect_headers(actorStr,cookie) self._redirect_headers(actorStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,10)
return return
# read the bytes of the http form POST # read the bytes of the http form POST
@ -3726,11 +3708,9 @@ class PubServer(BaseHTTPRequestHandler):
deactivateAccount(self.server.baseDir,nickname,self.server.domain) deactivateAccount(self.server.baseDir,nickname,self.server.domain)
self._clearLoginDetails(nickname) self._clearLoginDetails(nickname)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,11)
return return
self._redirect_headers(actorStr,cookie) self._redirect_headers(actorStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,12)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,3) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,3)
@ -3759,7 +3739,6 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,14)
return return
elif moderationStr.startswith('submitBlock'): elif moderationStr.startswith('submitBlock'):
moderationButton='block' moderationButton='block'
@ -3845,7 +3824,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug) self.server.debug)
self._redirect_headers(actorStr+'/moderation',cookie) self._redirect_headers(actorStr+'/moderation',cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,15)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,4) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,4)
@ -3875,7 +3853,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domainFull+self.path.replace('/question','') self.server.domainFull+self.path.replace('/question','')
nickname=getNicknameFromActor(actor) nickname=getNicknameFromActor(actor)
if not nickname: if not nickname:
self._benchmarkPOST(POSTstartTime,16)
self._redirect_headers(actor+'/inbox?page='+ \ self._redirect_headers(actor+'/inbox?page='+ \
str(pageNumber),cookie) str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -3922,7 +3899,6 @@ class PubServer(BaseHTTPRequestHandler):
print('ERROR: unable to create vote') print('ERROR: unable to create vote')
self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie) self._redirect_headers(actor+'/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,17)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,6) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,6)
@ -3970,7 +3946,6 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,18)
return return
elif searchStr.startswith('*'): elif searchStr.startswith('*'):
# skill search # skill search
@ -3985,7 +3960,6 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,19)
return return
elif '@' in searchStr: elif '@' in searchStr:
# profile search # profile search
@ -4011,12 +3985,10 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,20)
return return
else: else:
self._redirect_headers(actorStr+'/search',cookie) self._redirect_headers(actorStr+'/search',cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,21)
return return
elif searchStr.startswith(':') or \ elif searchStr.startswith(':') or \
searchStr.lower().strip('\n').endswith(' emoji'): searchStr.lower().strip('\n').endswith(' emoji'):
@ -4033,7 +4005,6 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,22)
return return
else: else:
# shared items search # shared items search
@ -4050,9 +4021,7 @@ class PubServer(BaseHTTPRequestHandler):
self._login_headers('text/html',len(msg)) self._login_headers('text/html',len(msg))
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,23)
return return
self._benchmarkPOST(POSTstartTime,24)
self._redirect_headers(actorStr+'/inbox',cookie) self._redirect_headers(actorStr+'/inbox',cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
return return
@ -4080,7 +4049,6 @@ class PubServer(BaseHTTPRequestHandler):
shareNickname,shareDomain,shareName) shareNickname,shareDomain,shareName)
self._redirect_headers(originPathStr+'/tlshares',cookie) self._redirect_headers(originPathStr+'/tlshares',cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,25)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,8) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,8)
@ -4126,7 +4094,6 @@ class PubServer(BaseHTTPRequestHandler):
self._redirect_headers(originPathStr+'/outbox?page='+ \ self._redirect_headers(originPathStr+'/outbox?page='+ \
str(pageNumber),cookie) str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,26)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,9) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,9)
@ -4144,7 +4111,6 @@ class PubServer(BaseHTTPRequestHandler):
followingActor=followingActor.split('&')[0] followingActor=followingActor.split('&')[0]
self._redirect_headers(followingActor,cookie) self._redirect_headers(followingActor,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,27)
return return
if '&submitYes=' in followConfirmParams: if '&submitYes=' in followConfirmParams:
followingActor= \ followingActor= \
@ -4179,7 +4145,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion) self.server.projectVersion)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,28)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,10) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,10)
@ -4228,7 +4193,6 @@ class PubServer(BaseHTTPRequestHandler):
self._postToOutboxThread(unfollowJson) self._postToOutboxThread(unfollowJson)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,29)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,11) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,11)
@ -4241,7 +4205,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+originPathStr) print('WARN: unable to find nickname in '+originPathStr)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,30)
return return
length = int(self.headers['Content-length']) length = int(self.headers['Content-length'])
blockConfirmParams=self.rfile.read(length).decode('utf-8') blockConfirmParams=self.rfile.read(length).decode('utf-8')
@ -4255,7 +4218,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+blockingActor) print('WARN: unable to find nickname in '+blockingActor)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,31)
return return
blockingDomain,blockingPort=getDomainFromActor(blockingActor) blockingDomain,blockingPort=getDomainFromActor(blockingActor)
blockingDomainFull=blockingDomain blockingDomainFull=blockingDomain
@ -4276,7 +4238,6 @@ class PubServer(BaseHTTPRequestHandler):
blockingNickname,blockingDomainFull) blockingNickname,blockingDomainFull)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,32)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,12) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,12)
@ -4289,7 +4250,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+originPathStr) print('WARN: unable to find nickname in '+originPathStr)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,33)
return return
length = int(self.headers['Content-length']) length = int(self.headers['Content-length'])
blockConfirmParams=self.rfile.read(length).decode('utf-8') blockConfirmParams=self.rfile.read(length).decode('utf-8')
@ -4303,7 +4263,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+blockingActor) print('WARN: unable to find nickname in '+blockingActor)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,34)
return return
blockingDomain,blockingPort= \ blockingDomain,blockingPort= \
getDomainFromActor(blockingActor) getDomainFromActor(blockingActor)
@ -4327,7 +4286,6 @@ class PubServer(BaseHTTPRequestHandler):
blockingNickname,blockingDomainFull) blockingNickname,blockingDomainFull)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,35)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,13) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,13)
@ -4342,7 +4300,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+originPathStr) print('WARN: unable to find nickname in '+originPathStr)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,36)
return return
length = int(self.headers['Content-length']) length = int(self.headers['Content-length'])
optionsConfirmParams= \ optionsConfirmParams= \
@ -4374,7 +4331,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: unable to find nickname in '+optionsActor) print('WARN: unable to find nickname in '+optionsActor)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,37)
return return
optionsDomain,optionsPort=getDomainFromActor(optionsActor) optionsDomain,optionsPort=getDomainFromActor(optionsActor)
optionsDomainFull=optionsDomain optionsDomainFull=optionsDomain
@ -4393,7 +4349,6 @@ class PubServer(BaseHTTPRequestHandler):
print('Viewing '+optionsActor) print('Viewing '+optionsActor)
self._redirect_headers(optionsActor,cookie) self._redirect_headers(optionsActor,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,38)
return return
if '&submitBlock=' in optionsConfirmParams: if '&submitBlock=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
@ -4413,7 +4368,6 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,39)
return return
if '&submitFollow=' in optionsConfirmParams: if '&submitFollow=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
@ -4426,7 +4380,6 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,40)
return return
if '&submitUnfollow=' in optionsConfirmParams: if '&submitUnfollow=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
@ -4439,7 +4392,6 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,41)
return return
if '&submitDM=' in optionsConfirmParams: if '&submitDM=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
@ -4453,7 +4405,6 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,42)
return return
if '&submitSnooze=' in optionsConfirmParams: if '&submitSnooze=' in optionsConfirmParams:
thisActor=self.path.split('/personoptions')[0] thisActor=self.path.split('/personoptions')[0]
@ -4462,7 +4413,6 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in thisActor: if '/users/' in thisActor:
nickname=thisActor.split('/users/')[1] nickname=thisActor.split('/users/')[1]
personSnooze(self.server.baseDir,nickname,self.server.domain,optionsActor) personSnooze(self.server.baseDir,nickname,self.server.domain,optionsActor)
self._benchmarkPOST(POSTstartTime,43)
self._redirect_headers(thisActor+ \ self._redirect_headers(thisActor+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4474,7 +4424,6 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in thisActor: if '/users/' in thisActor:
nickname=thisActor.split('/users/')[1] nickname=thisActor.split('/users/')[1]
personUnsnooze(self.server.baseDir,nickname,self.server.domain,optionsActor) personUnsnooze(self.server.baseDir,nickname,self.server.domain,optionsActor)
self._benchmarkPOST(POSTstartTime,44)
self._redirect_headers(thisActor+ \ self._redirect_headers(thisActor+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4490,10 +4439,8 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/html',len(msg),cookie) self._set_headers('text/html',len(msg),cookie)
self._write(msg) self._write(msg)
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,45)
return return
self._benchmarkPOST(POSTstartTime,46)
self._redirect_headers(originPathStr,cookie) self._redirect_headers(originPathStr,cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
return return
@ -4505,7 +4452,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,47)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4515,7 +4461,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,48)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4525,7 +4470,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,49)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4535,7 +4479,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,50)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4545,7 +4488,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,51)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/inbox?page='+str(pageNumber),cookie) '/inbox?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4555,7 +4497,6 @@ class PubServer(BaseHTTPRequestHandler):
nickname=self.path.split('/users/')[1] nickname=self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname=nickname.split('/')[0] nickname=nickname.split('/')[0]
self._benchmarkPOST(POSTstartTime,52)
self._redirect_headers('/users/'+nickname+ \ self._redirect_headers('/users/'+nickname+ \
'/shares?page='+str(pageNumber),cookie) '/shares?page='+str(pageNumber),cookie)
self.server.POSTbusy=False self.server.POSTbusy=False
@ -4573,7 +4514,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(405) self.send_response(405)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,53)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,16) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,16)
@ -4589,7 +4529,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,54)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,17) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,17)
@ -4606,7 +4545,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,55)
return return
else: else:
if length>self.server.maxMediaSize: if length>self.server.maxMediaSize:
@ -4614,7 +4552,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,56)
return return
# receive images to the outbox # receive images to the outbox
@ -4626,14 +4563,12 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,57)
return return
pathUsersSection=self.path.split('/users/')[1] pathUsersSection=self.path.split('/users/')[1]
if '/' not in pathUsersSection: if '/' not in pathUsersSection:
self.send_response(404) self.send_response(404)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,58)
return return
self.postFromNickname=pathUsersSection.split('/')[0] self.postFromNickname=pathUsersSection.split('/')[0]
accountsDir= \ accountsDir= \
@ -4643,7 +4578,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(404) self.send_response(404)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,59)
return return
mediaBytes=self.rfile.read(length) mediaBytes=self.rfile.read(length)
mediaFilenameBase=accountsDir+'/upload' mediaFilenameBase=accountsDir+'/upload'
@ -4661,7 +4595,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(201) self.send_response(201)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,60)
return return
# refuse to receive non-json content # refuse to receive non-json content
@ -4677,7 +4610,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,61)
return return
if self.server.debug: if self.server.debug:
@ -4698,7 +4630,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: post to shared inbox is too long '+str(length)+' bytes') print('WARN: post to shared inbox is too long '+str(length)+' bytes')
self._400() self._400()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,125)
return return
messageBytes=self.rfile.read(length) messageBytes=self.rfile.read(length)
@ -4710,7 +4641,6 @@ class PubServer(BaseHTTPRequestHandler):
print('WARN: post to shared inbox is too long '+str(lenMessage)+' bytes') print('WARN: post to shared inbox is too long '+str(lenMessage)+' bytes')
self._400() self._400()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,125)
return return
# convert the raw bytes to json # convert the raw bytes to json
@ -4727,7 +4657,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(201) self.send_response(201)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,62)
return return
else: else:
if self.server.debug: if self.server.debug:
@ -4735,7 +4664,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,63)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,20) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,20)
@ -4753,7 +4681,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,64)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,21) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,21)
@ -4765,7 +4692,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,66)
return return
self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,22) self._benchmarkPOSTtimings(POSTstartTime,POSTtimings,22)
@ -4779,7 +4705,6 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,65)
return return
if self.server.debug: if self.server.debug:
@ -4804,13 +4729,11 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(200) self.send_response(200)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,67)
return return
if queueStatus==1: if queueStatus==1:
self.send_response(503) self.send_response(503)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,68)
return return
if self.server.debug: if self.server.debug:
print('_updateInboxQueue exited without doing anything') print('_updateInboxQueue exited without doing anything')
@ -4820,25 +4743,21 @@ class PubServer(BaseHTTPRequestHandler):
self.send_response(403) self.send_response(403)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,69)
return return
else: else:
if self.path == '/sharedInbox' or self.path == '/inbox': if self.path == '/sharedInbox' or self.path == '/inbox':
print('DEBUG: POST to shared inbox') print('DEBUG: POST to shared inbox')
self._benchmarkPOST(POSTstartTime,700)
queueStatus= \ queueStatus= \
self._updateInboxQueue('inbox',messageJson,messageBytes) self._updateInboxQueue('inbox',messageJson,messageBytes)
if queueStatus==0: if queueStatus==0:
self.send_response(200) self.send_response(200)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,70)
return return
if queueStatus==1: if queueStatus==1:
self.send_response(503) self.send_response(503)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False
self._benchmarkPOST(POSTstartTime,71)
return return
self.send_response(200) self.send_response(200)
self.end_headers() self.end_headers()