forked from indymedia/epicyon
get and post intervals set to one second
parent
d056f14ed6
commit
d532882972
|
@ -631,7 +631,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# should be above this
|
||||
if self.server.GETbusy:
|
||||
currTimeGET=int(time.time())
|
||||
if currTimeGET-self.server.lastGET<10:
|
||||
if currTimeGET-self.server.lastGET==0:
|
||||
if self.server.debug:
|
||||
print('DEBUG: GET Busy')
|
||||
self.send_response(429)
|
||||
|
@ -1824,7 +1824,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
str(self.server.POSTbusy))
|
||||
if self.server.POSTbusy:
|
||||
currTimePOST=int(time.time())
|
||||
if currTimePOST-self.server.lastPOST<10:
|
||||
if currTimePOST-self.server.lastPOST==0:
|
||||
self.send_response(429)
|
||||
self.end_headers()
|
||||
return
|
||||
|
|
|
@ -42,11 +42,12 @@ def getJson(session,url: str,headers: {},params: {}, \
|
|||
try:
|
||||
result=session.get(url, headers=sessionHeaders, params=sessionParams)
|
||||
return result.json()
|
||||
except:
|
||||
except Exception as e:
|
||||
print('ERROR: getJson failed')
|
||||
print('url: '+url)
|
||||
print('headers: '+str(sessionHeaders))
|
||||
print('params: '+str(sessionParams))
|
||||
print(e)
|
||||
return None
|
||||
|
||||
def postJson(session,postJsonObject: {},federationList: [],inboxUrl: str,headers: {},capability: str) -> str:
|
||||
|
|
|
@ -57,10 +57,11 @@ def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}, \
|
|||
hdr = {'Accept': 'application/jrd+json'}
|
||||
try:
|
||||
result = getJson(session, url, hdr, par,projectVersion,httpPrefix,fromDomain)
|
||||
except:
|
||||
except Exception as e:
|
||||
print("Unable to webfinger " + url)
|
||||
print('headers: '+str(hdr))
|
||||
print('params: '+str(par))
|
||||
print(e)
|
||||
return None
|
||||
storeWebfingerInCache(nickname+'@'+wfDomain,result,cachedWebfingers)
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue