Opened 2 months ago

Last modified 7 weeks 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 Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Sowa)

Currently utils/autoreload.py 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 (4)

comment:1 Changed 2 months ago by Adam Sowa

Description: modified (diff)

comment:2 Changed 7 weeks ago by Tim Graham

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

comment:3 Changed 7 weeks ago by Tom Forbes

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

I've got a PR in that ticket (https://github.com/django/django/pull/8819) 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 7 weeks ago by Tim Graham (previous) (diff)

comment:4 Changed 7 weeks ago by Tom Forbes

Cc: Tom Forbes added
Note: See TracTickets for help on using tickets.
Back to Top