Worker Processes initiates background scheduler everytime. #10603
Unanswered
debadatta-tiger-analytics
asked this question in
Questions
Replies: 1 comment
-
Often this type of functionality is abstracted outside of the application using something like celery. You may be able to achieve something similar by moving this functionality into Gunicorns start up hook https://docs.gunicorn.org/en/stable/settings.html#server-hooks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
This is my on startup event, and I have 3 background processes.
The command I am using to run my FastAPI app is ->
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app.main:app --preload --timeout 30000
So, due to 4 workers, the jobs are getting called 4 times. How to avoid this?
I have tried having 3 individual startup functions, that is also not working, one of the job is to send mails periodically, so it sends same mail 4 times to a user
Operating System
Windows
Operating System Details
No response
FastAPI Version
0.89.1
Pydantic Version
1.10.6
Python Version
3.11.4
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions