(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)
- Launch a simple flask server in debug mode (FLASK_DEBUG=1)
- Make http request
- 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)
(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 WerkzeugWatchdogReloaderLoopto 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
Trickevent handlers (gorakhargosh/watchdog@25a2d1f)Server should not restart on every http request when a watchdog reloader is being used.
Environment: