Unverified Commit 18c99b60 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] Only send the filesystem caching timing messages for slow events (#84646)

These are not very actionable for end users, but if they take more than 10s it might be a useful clue about system performance.
parent 714a7020
......@@ -1184,10 +1184,13 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
if new_items {
let elapsed = start.elapsed();
turbo_tasks().send_compilation_event(Arc::new(TimingEvent::new(
"Finished writing to filesystem cache".to_string(),
elapsed,
)));
// avoid spamming the event queue with information about fast operations
if elapsed > Duration::from_secs(10) {
turbo_tasks().send_compilation_event(Arc::new(TimingEvent::new(
"Finished writing to filesystem cache".to_string(),
elapsed,
)));
}
}
Some((snapshot_time, new_items))
......
use std::{cmp::max, path::PathBuf, sync::Arc, thread::available_parallelism, time::Instant};
use std::{
cmp::max,
path::PathBuf,
sync::Arc,
thread::available_parallelism,
time::{Duration, Instant},
};
use anyhow::{Ok, Result};
use parking_lot::Mutex;
......@@ -135,8 +141,11 @@ fn do_compact(
})?;
if ran {
let elapsed = start.elapsed();
turbo_tasks()
.send_compilation_event(Arc::new(TimingEvent::new(message.to_string(), elapsed)));
// avoid spamming the event queue with information about fast operations
if elapsed > Duration::from_secs(10) {
turbo_tasks()
.send_compilation_event(Arc::new(TimingEvent::new(message.to_string(), elapsed)));
}
}
Ok(())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment