Closed tisonkun closed 6 months ago
Seems it depends on the OS whether events can be emitted - https://github.com/fsnotify/fsnotify/issues/49
I suggest you watch the parent folder. Does that work for you?
Yes. This is how I finally worked it out - https://github.com/GreptimeTeam/greptimedb/pull/3566/commits/408f8df934313f892b52abfdf55ec3a5ace7e6bb (among https://github.com/GreptimeTeam/greptimedb/pull/3566)
My scenario is to watch a credential file; if not exist, bypass authentication; otherwise read the content to build the map.
I found that if the file exists and later deleted and recreated, all the loading can happen properly. But
notify
requires the file to exist initially:Since we can anyway delete the file later it starts, I wonder if we can relax this condition (or at lease when
RecursiveMode::NonRecursive
) so that make it possible to watch on a maybe non-existing file.cc @0xpr03