feat: reload server config when file is touched

Closes kemitix/git-next#84
This commit is contained in:
Paul Campbell 2024-07-16 07:14:06 +01:00
parent 619e1d517d
commit 33907a1d32

View file

@ -57,7 +57,9 @@ impl Handler<WatchFile> for FileWatcher {
fn handle(&mut self, _msg: WatchFile, _ctx: &mut Self::Context) -> Self::Result {
let mut buffer = [0u8; 4096];
if let Ok(mut events) = self.inotify.read_events(&mut buffer) {
if events.any(|event| event.mask.contains(EventMask::MODIFY)) {
if events.any(|event| {
event.mask.contains(EventMask::MODIFY) || event.mask.contains(EventMask::ATTRIB)
}) {
tracing::info!("File modified");
self.recipient.do_send(FileUpdated);
};