Ich habe der Dokumentation befolgt, um einer Azure-Funktions-App mit Fastapi Hintergrundaufgaben hinzuzufügen: < /p>
async def background_task():
logging.info("Background task started")
await asyncio.sleep(5)
logging.info("Background task finished")
@app.get("/do_background_task")
async def do_background_task(background_tasks: BackgroundTasks):
background_tasks.add_task(background_task)
return {"message": "Background task started, this response should return immediately."}
< /code>
funktioniert jedoch nicht wie erwartet und die Antwort wird erst nach 5 Sekunden zurückgegeben. Das Forked -Repository mit Reproduktionsfall finden Sie hier. Ist dies eine Einschränkung aus Azurefunktionen oder mache ich etwas falsch?
Fastapi -Hintergrundaufgaben funktionieren nicht auf Azure -Funktions -Apps ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post