#21356 closed Cleanup/optimization (fixed)
Instant auto-reloading on BSD / OS X
| Reported by: | Aymeric Augustin | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
In the wake of #9722, I'd like to implement the same feature on OS X, preferably without external dependencies.
Pull request: https://github.com/django/django/pull/1830
However, I'm often seeing two or three reloads in a row when a single file in changed. I'm not sure where that behavior comes from. Thoughts?
Change History (7)
comment:1 by , 12 years ago
| Has patch: | set |
|---|---|
| Patch needs improvement: | set |
comment:2 by , 12 years ago
comment:3 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:4 by , 12 years ago
I'm getting a ValueError: current limit exceeds maximum limit.
This happens in the PyCharm console, but not in the terminal.
resource.getrlimit returns (10240, 9223372036854775807) in PyCharm and (256, 9223372036854775807) in the terminal.
The issue is 10240 is actually the kernel limit for my system as demonstrated by sysctl kern.maxfilesperproc; so when we do NOFILES_SOFT + len(filenames) we try to go over the kernel hard limit which causes the ValueError.
It's not clear to me why the second return value of resource.getrlimit is not equal to the actual kernel hard limit...
I'm not sure how to proceed at this point.
comment:6 by , 12 years ago
Here's an alternative solution that gets the actual limit from the kernel.
I would limit the
fflagsto:fflags = ( select.KQ_NOTE_DELETE | select.KQ_NOTE_WRITE | select.KQ_NOTE_EXTEND | select.KQ_NOTE_RENAME )I suspect the reason for the multiple reloads is that modern text editors do all sorts of fancy things to files, which could trigger extra events.
With the previous set of
fflags, I haven't managed to trigger more than one event by using thetouchcommand, while my text editor (PyCharm) would reload almost at every key stroke.With the restricted set of
fflags, I only get a reload when the changes are committed, which is the expected outcome.