When using await/async
, does it have to go "all the way up", meaning, does every function in the call chain have to use it?
E.g.:
def a():
# can't call b() here
async def b():
return await c
async def c():
return ...
I recently wondered this in the context of a flask app running under gevent, where one of the endpoints was a long running call that should be "checked upon", while not blocking other calls
def handler0():
# short running
return ...
def handler(): # blocks handler0
return await some_long_thing()
async def some_long_thinig():
# ..do somethiing
return ...