lundi 6 juillet 2020

Returning a status code early for a time consuming function in Flask

I have an API route that calls a function (ie: doSomethingForALongTime) that takes some time to finish. If we assume that the function doesn't return anything to the client, is there a work around to just call the function and send the status code 200 while the function is doing it's job?

@application.route('/api', methods=['GET'])
def api_route():
    doSomethingForALongTime() 
    return 200



Aucun commentaire:

Enregistrer un commentaire