Running on Windows.
This is similiar to the question python flask - run script after processing the request however the answers to that one were insufficient.
Given the code:
app = Flask(__name__)
@app.route('/',methods=['POST'])
def processWebhook():
time.sleep(30) # slow_function()
return "received"
if __name__ == '__main__':
app.run()
I need the slow_function to run for each POST, however it can't stop the response being returned within 5 seconds (say the function is time.sleep(30)).
Also, each slow_function cannot start until the one before has finished.
Is there a way I can add "jobs" to a second thread that execute linearly rather than just calling slow_function?