lambdaisland / lambdaisland/classpath

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

Abierto
#7 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement help wanted
Lenguaje dominante
Clojure
Estrellas
90
Forks
7
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza por el DirectoryWatcher creado por watch-deps y revisa cómo beholder y directory-watcher registran actualmente las vigilancias recursivas y calculan los hashes de los archivos. Compara ese comportamiento con java.nio.file.WatchService; la implementación terminada debería evitar escanear y volver a calcular los hashes de archivos del proyecto no relacionados, y seguir detectando modificaciones en deps.edn.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
clojure, java
Área
performance, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.