优化接口响应速度
This commit is contained in:
parent
64c6b009d8
commit
d352df3846
|
|
@ -233,7 +233,18 @@ def test_split_api():
|
|||
|
||||
@app.route('/api/do_distribute_cross', methods=['POST'])
|
||||
def do_distribute_cross():
|
||||
return distribute_cross(request.get_json())
|
||||
res = distribute_cross(request.get_json())
|
||||
# 手动gzip压缩
|
||||
compressed_data = gzip.compress(res.encode('utf-8'), compresslevel=6)
|
||||
|
||||
return Response(
|
||||
compressed_data,
|
||||
headers={
|
||||
'Content-Encoding': 'gzip',
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': str(len(compressed_data))
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@app.route('/api/cross_monitor_record_info', methods=['GET'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue