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

Reload Behavior: Documentation != Code, Unnecessary Reloads #656

Closed
kalzoo opened this issue Apr 28, 2020 · 3 comments · Fixed by #660
Closed

Reload Behavior: Documentation != Code, Unnecessary Reloads #656

kalzoo opened this issue Apr 28, 2020 · 3 comments · Fixed by #660

Comments

@kalzoo
Copy link

kalzoo commented Apr 28, 2020

Hey! I upgraded to 0.11.4 shortly after release today, and it has a couple of quirks.

  1. The documentation here says "python file changes" but the code says "all non-dotfile changes".
  2. That behavior, while from the test cases seems to be intended to roll up things like .graphql files, also unfortunately rolls up .pyc files, meaning every restart is a double restart:
WARNING:  Detected file change in 'app/main.py'. Reloading...
INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [87024]
INFO:     Started server process [87080]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
WARNING:  Detected file change in 'app/__pycache__/main.cpython-37.pyc'. Reloading...
INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [87080]
INFO:     Started server process [87093]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

It might be better to use Path.glob so users can specify file extensions and paths more explicitly than with os.walk, but it's published already so maybe as another flag?

  1. A minor point, but worth noting in the docs: --reload_dir on the CLI becomes reload_dirs=['my_dir'] in code: uvicorn.run('app.main:app', host="0.0.0.0", port=8000, reload=True, reload_dirs=['app'])

Thanks for making this great library!

@euri10
Copy link
Member

euri10 commented Apr 28, 2020

Can you please paste the output just above what you pasted just to see what reloader it uses?

@euri10
Copy link
Member

euri10 commented Apr 28, 2020

ok it's on statreloader, will send a PR asap

@tomchristie
Copy link
Member

Thanks for reporting this! 0.11.5 is now published... https://github.com/encode/uvicorn/runs/629310851?check_suite_focus=true

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

Successfully merging a pull request may close this issue.

3 participants