main
luanhailiang 2023-09-22 15:55:28 +08:00
parent 66851f9b27
commit 62a80cd000
1 changed files with 6 additions and 2 deletions

8
app.py
View File

@ -137,7 +137,7 @@ def worker(id,source,region=None,stream=False):
else: else:
yield f"data: {json_data}\n\n" yield f"data: {json_data}\n\n"
use += " yield:"+str((time.time()*1000) - bgn) use += " yield:"+str((time.time()*1000) - bgn)
print(use) print("model.track",use)
except GeneratorExit: except GeneratorExit:
print("Client disconnected at", time.ctime()) print("Client disconnected at", time.ctime())
@ -161,16 +161,20 @@ def workerloop(stop_event,id,source,target=None,region=None):
thread.start() thread.start()
use += " post:"+str((time.time()*1000) - bgn) use += " post:"+str((time.time()*1000) - bgn)
print("gen",use) print("workerloop",use)
finally: finally:
gen.close() gen.close()
def post_request(url, data): def post_request(url, data):
use = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
bgn = (time.time()*1000)
headers = { headers = {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
response = requests.post(url, data=data,headers=headers) response = requests.post(url, data=data,headers=headers)
print(response.text) print(response.text)
use += " post:"+str((time.time()*1000) - bgn + "ms")
print("post_request",use)
# import pstats # import pstats
# import cProfile # import cProfile