Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't hash contents of every watched file #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/nextjournal/beholder.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns nextjournal.beholder
(:import [io.methvin.watcher DirectoryChangeEvent DirectoryChangeEvent$EventType
DirectoryChangeListener DirectoryWatcher]
[io.methvin.watcher.hashing FileHasher]
[java.nio.file Paths]))

(defn- fn->listener ^DirectoryChangeListener [f]
Expand All @@ -24,6 +25,7 @@
Not meant to be called directly but use `watch` or `watch-blocking` instead."
[cb paths]
(-> (DirectoryWatcher/builder)
(.fileHasher FileHasher/LAST_MODIFIED_TIME)
(.paths (map to-path paths))
(.listener (fn->listener cb))
(.build)))
Expand Down