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

WatchdogReloaderLoop reloading on every http request due to change in watchdog #2603

Closed
jdimmerman opened this issue Feb 28, 2023 · 1 comment · Fixed by #2604
Closed

WatchdogReloaderLoop reloading on every http request due to change in watchdog #2603

jdimmerman opened this issue Feb 28, 2023 · 1 comment · Fixed by #2604
Labels
Milestone

Comments

@jdimmerman
Copy link
Contributor

(Note, I'm not sure if this is an issue in werkzeug or watchdog as I think this is an intentional change in behavior in watchdog)

The watchdog event handler PatternMatchingEventHandler.on_any_event() as of 2.3.0 now includes file opened events. This is causing the Werkzeug WatchdogReloaderLoop to reload whenever a file is opened. Flask, in debug mode, uses this reloader and as a result, the reloader has become a challenge to use as files are opened on each http request (generally).
(gorakhargosh/watchdog@2b09f64)

Note that in 2.3.1, watchdog started to ignore file open events, but only for Trick event handlers (gorakhargosh/watchdog@25a2d1f)

  1. Launch a simple flask server in debug mode (FLASK_DEBUG=1)
  2. Make http request
  3. Server restarts

Server should not restart on every http request when a watchdog reloader is being used.

Environment:

  • Python version: 3.11.2
  • Werkzeug version: 2.2.3
  • Watchdog version: 2.3.1 and 2.3.0 (both)
@davidism
Copy link
Member

Happy to review a PR that ignores these open events.

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

Successfully merging a pull request may close this issue.

2 participants