I am in the process of trying to port a flask
app to quart
to utilise asyncio
. I don't think my current approach is working, as my entire function chain is written without async in mind - consider the following:
def long_running_task(task):
result = some_synchronous_function(task)
return result
@app.route('/<task>', methods=['GET'])
async def do_task(task):
ok = await long_running_task(task)
if ok:
return (ok.result)
else:
return ('Something went wrong')
If long_running_task
and its whole chain of function calls are not declared as async
, am I actually getting any benefit from my route being declared as async
?