• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 5869050642

pending completion
5869050642

Pull #1858

github

supergi0
updated readme
Pull Request #1858: feat: Implement graph for dozer-live ui

419 of 419 new or added lines in 15 files covered. (100.0%)

46002 of 59761 relevant lines covered (76.98%)

52423.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/dozer-cli/src/live/watcher.rs
1
use std::{sync::Arc, time::Duration};
2

3
use crate::shutdown::ShutdownReceiver;
4

5
use super::{state::LiveState, LiveError};
6

7
use dozer_types::log::info;
8
use notify::{RecursiveMode, Watcher};
9
use notify_debouncer_full::new_debouncer;
10

11
pub fn watch(state: Arc<LiveState>, shutdown: ShutdownReceiver) -> Result<(), LiveError> {
×
12
    // setup debouncer
×
13
    let (tx, rx) = std::sync::mpsc::channel();
×
14

×
15
    let dir: std::path::PathBuf = std::env::current_dir()?;
×
16
    let mut debouncer = new_debouncer(Duration::from_millis(500), None, tx)?;
×
17

×
18
    let watcher = debouncer.watcher();
×
19

×
20
    watcher.watch(dir.as_path(), RecursiveMode::Recursive)?;
×
21

22
    debouncer
×
23
        .cache()
×
24
        .add_root(dir.as_path(), RecursiveMode::Recursive);
×
25

×
26
    let running = shutdown.get_running_flag().clone();
×
27
    loop {
×
28
        let event = rx.recv_timeout(Duration::from_millis(100));
×
29
        match event {
×
30
            Ok(result) => match result {
×
31
                Ok(_events) => {
×
32
                    build(state.clone())?;
×
33
                }
×
34
                Err(errors) => errors.iter().for_each(|error| info!("{error:?}")),
×
35
            },
×
36
            Err(e) => {
×
37
                if !running.load(std::sync::atomic::Ordering::Relaxed) {
×
38
                    break;
×
39
                }
×
40
                if e == std::sync::mpsc::RecvTimeoutError::Disconnected {
×
41
                    break;
×
42
                }
×
43
            }
×
44
        }
×
45
    }
×
46

×
47
    Ok(())
×
48
}
×
49

50
pub fn build(state: Arc<LiveState>) -> Result<(), LiveError> {
×
51
    state.set_dozer(None);
×
52

×
53
    state.broadcast()?;
×
54

×
55
    if let Err(res) = state.build() {
×
56
        state.set_error_message(Some(res.to_string()));
×
57
    } else {
×
58
        state.set_error_message(None);
×
59
    }
×
60
    state.broadcast()
×
61
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc