feat: reload server config when file is touched
Some checks failed
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
Rust / build (push) Has been cancelled

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 { 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);
}; };