forked from indymedia/epicyon
Log slow json saves
parent
0990bab4d1
commit
ef9056761b
11
daemon.py
11
daemon.py
|
@ -774,6 +774,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
#pprint(messageJson)
|
#pprint(messageJson)
|
||||||
|
|
||||||
|
beginSaveTime=time.time()
|
||||||
# save the json for later queue processing
|
# save the json for later queue processing
|
||||||
queueFilename = \
|
queueFilename = \
|
||||||
savePostToInboxQueue(self.server.baseDir,
|
savePostToInboxQueue(self.server.baseDir,
|
||||||
|
@ -789,6 +790,16 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# add json to the queue
|
# add json to the queue
|
||||||
if queueFilename not in self.server.inboxQueue:
|
if queueFilename not in self.server.inboxQueue:
|
||||||
self.server.inboxQueue.append(queueFilename)
|
self.server.inboxQueue.append(queueFilename)
|
||||||
|
if self.server.debug:
|
||||||
|
timeDiff=int((time.time()-beginSaveTime)*1000)
|
||||||
|
if timeDiff>200:
|
||||||
|
print('WARN: slow save of inbox queue item '+queueFilename+' took '+str(timeDiff)+' mS')
|
||||||
|
try:
|
||||||
|
with open(queueFilename, 'r') as fp:
|
||||||
|
queueJson=commentjson.load(fp)
|
||||||
|
print('SLOW: '+str(queueJson))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.send_response(201)
|
self.send_response(201)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.server.POSTbusy=False
|
self.server.POSTbusy=False
|
||||||
|
|
Loading…
Reference in New Issue