Unverified Commit 1a6b1a62 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: do not run a compaction when opening the db (#82635)

### What?

Do not run a compaction when opening the DB. We are already busy when starting up, so no need to add more work to that.
parent f79cd752
...@@ -40,24 +40,12 @@ pub struct TurboKeyValueDatabase { ...@@ -40,24 +40,12 @@ pub struct TurboKeyValueDatabase {
impl TurboKeyValueDatabase { impl TurboKeyValueDatabase {
pub fn new(versioned_path: PathBuf, is_ci: bool, is_short_session: bool) -> Result<Self> { pub fn new(versioned_path: PathBuf, is_ci: bool, is_short_session: bool) -> Result<Self> {
let db = Arc::new(TurboPersistence::open(versioned_path)?); let db = Arc::new(TurboPersistence::open(versioned_path)?);
let mut this = Self { Ok(Self {
db: db.clone(), db: db.clone(),
compact_join_handle: Mutex::new(None), compact_join_handle: Mutex::new(None),
is_ci, is_ci,
is_short_session, is_short_session,
};
// start compaction in background if the database is not empty
if !db.is_empty() {
let handle = spawn(async move {
db.compact(&CompactConfig {
max_merge_segment_count: available_parallelism()
.map_or(4, |c| max(4, c.get() / 4)),
..COMPACT_CONFIG
}) })
});
this.compact_join_handle.get_mut().replace(handle);
}
Ok(this)
} }
} }
......
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