lambdaisland / lambdaisland/classpath

watch-deps watches (and hashes) all files in project

Aperta
#7 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement help wanted
Lingua principale
Clojure
Stelle
90
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal DirectoryWatcher creato da watch-deps e verifica come beholder e directory-watcher registrano attualmente le watch ricorsive e calcolano gli hash dei file. Confronta questo comportamento con java.nio.file.WatchService; l'implementazione completata dovrebbe evitare di scansionare e ricalcolare gli hash dei file di progetto non correlati, continuando comunque a rilevare le modifiche a deps.edn.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
clojure, java
Ambito
performance, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.