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

Run permanent sync thread after app.run () #28

Open
LeonidVas opened this issue Jul 7, 2021 · 1 comment
Open

Run permanent sync thread after app.run () #28

LeonidVas opened this issue Jul 7, 2021 · 1 comment

Comments

@LeonidVas
Copy link
Contributor

LeonidVas commented Jul 7, 2021

When the service runned by gunicorn, the code runs in the "workers", which are "pinged" by gunicorn. If the "worker" is silent for more than the value of the timeout option, the worker will be killed and restarted.
The "worker" is currently created when the service starts and can't be pinged by gunicorn before the app.run () was called.
The problem is that all repositories are synced when the service starts (before app.run ()) because:

  1. this sync can take a long time
  2. it must be executed once (in one thread). So. we can't run gunicorn with workers > 1.

Both problems can be solved by starting the server by gunicorn with the preload option, but in this case we should to run
permanent sync thread after calling app.run (). Now it's run when s3model is created.

@LeonidVas
Copy link
Contributor Author

May be useful https://www.py4u.net/discuss/141357

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

3 participants