Open zoranbosnjak opened 1 month ago
Answering my own question..., it looks like I need to do this:
@app.before_serving
async def startup():
app.add_background_task(background_task)
But there is another question. Suppose that a background_task is mandatory for the web application. Is there a way to force stop the web application automatically if the background task returns or crashes?
I am trying to run a loop concurrently with the web server, like this:
From the documentation it looks like I need a background_task. But when running this example, I am getting this exception:
AttributeError: 'QuartTrio' object has no attribute 'nursery'
. Is there something wrong in the code or a bug? I could not find any solution in the docs. Appreciate any suggestion.