This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

services/flix/ipfs: fix new directory file indexing

Replace watch_new_dir (which spawned a redundant background inotifywait
per directory and silently lost files) with a synchronous scan_new_dir
that immediately finds and adds all files. The main recursive watcher
already handles future events in new subdirectories.

+4 -23
+4 -23
2configs/services/flix/ipfs.nix
··· 79 79 done < "$CID_MAP" 80 80 log "Cleanup complete" 81 81 82 - # watch a new subdirectory for files 83 - watch_new_dir() { 82 + # add all files in a newly appeared directory 83 + scan_new_dir() { 84 84 local dir="$1" 85 - log "Watching new directory: $dir" 86 - # first add any files already in it 85 + log "Scanning new directory: $dir" 87 86 ${pkgs.findutils}/bin/find "$dir" -type f | while read -r f; do 88 87 add_file "$f" 89 - done 90 - # then watch for new files 91 - $INOTIFYWAIT -m -r \ 92 - -e close_write \ 93 - -e moved_to \ 94 - -e moved_from \ 95 - -e delete \ 96 - "$dir" | 97 - while read -r d event f; do 98 - path="''${d}''${f}" 99 - case "$event" in 100 - CLOSE_WRITE*|MOVED_TO*) 101 - add_file "$path" 102 - ;; 103 - DELETE*|MOVED_FROM*) 104 - remove_file "$path" 105 - ;; 106 - esac 107 88 done 108 89 } 109 90 ··· 120 101 path="''${dir}''${file}" 121 102 case "$event" in 122 103 CREATE,ISDIR*|MOVED_TO,ISDIR*) 123 - watch_new_dir "$path" & 104 + scan_new_dir "$path" 124 105 ;; 125 106 CLOSE_WRITE*|MOVED_TO*) 126 107 add_file "$path"