Fastapi -Hintergrundaufgaben funktionieren nicht auf Azure -Funktions -Apps

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Fastapi -Hintergrundaufgaben funktionieren nicht auf Azure -Funktions -Apps

by Anonymous » 19 Aug 2025, 14:32

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?

Top