-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Run background task in master process? #3401
Comments
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #1964 (The documentation on "Background tasks" is wrong), #1104 (Rewrite doc section about background tasks), #1921 (Run tasks (fetch urls) inside separate thread), #2745 (Running out of memory ), and #1092 (Allow to register application background tasks within an event loop). |
With The main question is what memory do you expect to have in I suspect you want to do something more complex than printing a line infinitely. |
Right, sorry for the missing info. |
If you don't care about scaling and performance -- you don't need gunicorn at all. |
Alright, thanks for the big-picture view. |
I deploy aiohttp behind gunicorn using multiple workers with the
--preload
option.Currently, I can run a background task using its own thread in the master process
It feels a bit dirty to use threads when I should be able to just hook into the event loop of the master process.
However, using app.on_startup does not work as the task will then be duplicated by each worker.
Is there a possibility to create a task only in the event loop of the master process or somehow remove the duplication by the workers?
The text was updated successfully, but these errors were encountered: