Opened 15 months ago

Last modified 12 months ago

#28602 new New feature

Filesystem watcher based autoreload implementation for Windows platform

Reported by: Adam Sowa Owned by: nobody
Component: Utilities Version: 1.11
Severity: Normal Keywords: autoreload
Cc: Tom Forbes, Tzu-ping Chung Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Adam Sowa)

Currently utils/ has implementation for inotify based file system watcher. On Windows it scans all files for changes every 1 second which takes a lot of CPU. Windows provides file system watching API (FindFirstChangeNotification) which does the same thing as inotify on Linux. Django should take advantage of the API to make autoreload more efficient.

Change History (6)

comment:1 Changed 15 months ago by Adam Sowa

Description: modified (diff)

comment:2 Changed 15 months ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

comment:3 Changed 15 months ago by Tom Forbes

This is similar to #27685 - Allow autoreloader to use watchman.

I've got a PR in that ticket ( to refactor the autoreloader and add support for the Watchdog library (and watchman) over pyinotify, which handles the intricacies of Windows, Linux and Mac file system notifications. IMO, after reading the Watchdog code and seeing the rather tricky corner cases it handles (e.g this) it would be best to outsource it there than maintain our own.

Perhaps we could split #27685 into two parts, one to add support for Windows/Mac/Linux FS notifications via Watchdog (this ticket) and one to expand it to support Watchman?

Last edited 15 months ago by Tim Graham (previous) (diff)

comment:4 Changed 15 months ago by Tom Forbes

Cc: Tom Forbes added

comment:5 Changed 12 months ago by Tzu-ping Chung

Cc: Tzu-ping Chung added

comment:6 Changed 12 months ago by Tim Graham

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top