I have the following Flask code:
from flask import Flask
active_ids = {}
@app.route('/',methods=['GET','POST','DELETE'])
def serve():
request_id = request.cookie['id']
if request_id not in active_ids:
# do my logic
if __name__ == '__main__':
app.run(host="0.0.0.0")
The function serve is thread safty? If not, what is the best why to make it?