Skip to content

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

Description

@jdimmerman

(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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions