I have two services, service A (node) and service B (flask) there is an endpoint on serivce A which calls endpoint of service B like this:
const response = await axios.get(
endpoint_url,
{
params: {
library_id: req.query.library_id,
},
}
);
在服务B方面,该图书馆有一个更新路线,更新了该图书馆的所有书籍,其编号为<>,需要一定时间。 我想服务B立即做出回应,并在背景中进行计算。 有一些图书馆被推荐为像文西奥、阅读、文莱等,但我不知道哪些图书馆最适合我,而我正在阅读,因为似乎最简单。 不过,“测试”没有在read开始后立即印刷,整个<代码>程序代码>功能在回复回复到点末之前即执行。 我在这里做了什么错误?
<service B endpoint:
import threading
from src.Library import Library
@bp_csv.route( update-library , methods=[ GET ])
def get_library():
library_id = request.args.get( library_id )
if not library_id:
raise ValueError("Missing query parameter library_id ")
LIB = Library(library_id)
thread = threading.Thread(target=LIB.process()).start()
print("testing")
status_code = 202
return_message = "Updating library"
response = make_response(
jsonify({"message": str(return_message)}), status_code)
response.headers["Content-Type"] = "application/json"
return response