lambdaisland / lambdaisland/classpath
watch-deps watches (and hashes) all files in project
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Clojure
- Sterne
- 90
- Forks
- 7
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
The default behaviors of https://github.com/nextjournal/beholder and https://github.com/gmethvin/directory-watcher cause watched folders to register watches on all subfolders recursively, and 'watching' a folder reads and hashes every file within it at startup and rehashes any created/modified files on every modification. Due to this, the DirectoryWatcher created by watch-deps is reading and hashing everything under the project folder recursively (including .git, node_modules, etc) and rehashing all modified files even though the callback registered by watch-deps ultimately ignores everything but modifications to deps.edn. This can cause a long delay when watch-deps is invoked for projects with large numbers of files or just large files (e.g. data files under resources/) due the hashing on startup, and unnecessary resource usage caused by rehashing every git commit, asset file update, etc.
DirectoryWatcher can be configured not to hash or to use the file modified timestamp instead of hashing, but these options are not exposed by beholder. It doesn't appear to be possible to watch a single folder without its children using DirectoryWatcher
Would a PR that uses the native java.nio.file.WatchService directly instead of beholder/DirectoryWatcher be welcome? It appears the downside would be that WatchService uses a polling implementation on MacOS, but since it would be possible to watch the project root without any children, I would think it would still be a net win for performance.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne beim von watch-deps erstellten DirectoryWatcher und überprüfe, wie beholder und directory-watcher derzeit rekursive Watches registrieren und Dateien hashen. Vergleiche dieses Verhalten mit java.nio.file.WatchService; die fertige Implementierung sollte das Scannen und erneute Hashen nicht zugehöriger Projektdateien vermeiden und dennoch Änderungen an deps.edn erkennen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- clojure, java
- Bereich
- performance, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100