sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

File watcher for site config file is not reliable #55127

Open eseliger opened 1 year ago

eseliger commented 1 year ago

When a file is recreated for atomic writes, the watcher stops working. Additionally, when write events are received, it could be that we fire and read the file before the full file content has been written.

I am not sure yet what the best path forward here is, either trying to fix it by making sure we keep listening even if the inode is destroyed (maybe by watching the directory it's in?), or by putting in some debouncing of write events, or if we should just say we remove the watcher feature, but the current state seems very unexpected to me.

/cc @sourcegraph/source

mrnugget commented 1 year ago

Do you mean this one? https://github.com/sourcegraph/sourcegraph/blob/0633c1d3c5ec4985057943fafa0e1aa976761041/cmd/frontend/internal/cli/config.go#L387-L412