forked from kemitix/git-next
feat: reload server config when file is touched
Closes kemitix/git-next#84
This commit is contained in:
parent
619e1d517d
commit
33907a1d32
1 changed files with 3 additions and 1 deletions
|
@ -57,7 +57,9 @@ impl Handler<WatchFile> for FileWatcher {
|
||||||
fn handle(&mut self, _msg: WatchFile, _ctx: &mut Self::Context) -> Self::Result {
|
fn handle(&mut self, _msg: WatchFile, _ctx: &mut Self::Context) -> Self::Result {
|
||||||
let mut buffer = [0u8; 4096];
|
let mut buffer = [0u8; 4096];
|
||||||
if let Ok(mut events) = self.inotify.read_events(&mut buffer) {
|
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");
|
tracing::info!("File modified");
|
||||||
self.recipient.do_send(FileUpdated);
|
self.recipient.do_send(FileUpdated);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue