Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastapi background tasks do not work on azure function apps #33

Open
warreee opened this issue May 6, 2024 · 1 comment
Open

fastapi background tasks do not work on azure function apps #33

warreee opened this issue May 6, 2024 · 1 comment

Comments

@warreee
Copy link

warreee commented May 6, 2024

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I added background tasks as described in https://fastapi.tiangolo.com/tutorial/background-tasks/.
You can see this in my fork of this repo: https://github.com/warreee/fastapi-on-azure-functions-background-tasks.
When running locally or in Azure will see that a response is not returned immediately but only after 5 seconds (the delay set in the background task).

Any log messages given by the failure

Expected/desired behavior

I expect the function app to give an immediate response while still finishing the background task afterwards.

OS and Version?

MacOs Sonoma

Versions

Function runtime: 4.33.2.2
Python: 3.11

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@eddison-shyi
Copy link

Me too, I've add "await asyncio.sleep(20)" in my background task function to test, then response back after 20 secs, and also block another request at same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants