MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / start

Method start

atomic-cli/src/commands/git/parallel.rs:2767–2805  ·  view source on GitHub ↗
(commit: String, summary: String)

Source from the content-addressed store, hash-verified

2765
2766impl SlowImportProgress {
2767 fn start(commit: String, summary: String) -> Self {
2768 let (done, rx) = mpsc::channel();
2769 let reported = Arc::new(AtomicBool::new(false));
2770 let reported_for_thread = Arc::clone(&reported);
2771 let handle = thread::spawn(move || {
2772 let started = Instant::now();
2773 // First heartbeat after a 5s quiet window, then every 15s. A
2774 // finished (sent) or abandoned (dropped) channel must STOP the
2775 // spinner: recv_timeout returns Err instantly on disconnect, and
2776 // the historical `if rx.recv_timeout(..).is_ok() { return }`
2777 // pattern spun forever printing thousands of heartbeats that
2778 // buried the actual refusal (review CB-9C R7).
2779 let mut first = true;
2780 loop {
2781 let quiet = if first {
2782 Duration::from_secs(5)
2783 } else {
2784 Duration::from_secs(15)
2785 };
2786 match rx.recv_timeout(quiet) {
2787 Ok(()) | Err(mpsc::RecvTimeoutError::Disconnected) => break,
2788 Err(mpsc::RecvTimeoutError::Timeout) => {}
2789 }
2790 reported_for_thread.store(true, Ordering::Relaxed);
2791 print_info(&format!(
2792 "Still importing {} after {}s; {}",
2793 commit,
2794 started.elapsed().as_secs(),
2795 summary
2796 ));
2797 }
2798 });
2799
2800 Self {
2801 done: Some(done),
2802 reported,
2803 handle: Some(handle),
2804 }
2805 }
2806
2807 /// Stop the spinner and report whether it fired. Idempotent: both the
2808 /// success path and the failing-synthesis path must close the channel, or

Callers

nothing calls this directly

Calls 2

print_infoFunction · 0.85
storeMethod · 0.45

Tested by

no test coverage detected