Skip to content

Commit 1a6b1a6

Browse files
authored
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.
1 parent f79cd75 commit 1a6b1a6

File tree

1 file changed

+2
-14
lines changed
  • turbopack/crates/turbo-tasks-backend/src/database/turbo

1 file changed

+2
-14
lines changed

turbopack/crates/turbo-tasks-backend/src/database/turbo/mod.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,12 @@ pub struct TurboKeyValueDatabase {
4040
impl TurboKeyValueDatabase {
4141
pub fn new(versioned_path: PathBuf, is_ci: bool, is_short_session: bool) -> Result<Self> {
4242
let db = Arc::new(TurboPersistence::open(versioned_path)?);
43-
let mut this = Self {
43+
Ok(Self {
4444
db: db.clone(),
4545
compact_join_handle: Mutex::new(None),
4646
is_ci,
4747
is_short_session,
48-
};
49-
// start compaction in background if the database is not empty
50-
if !db.is_empty() {
51-
let handle = spawn(async move {
52-
db.compact(&CompactConfig {
53-
max_merge_segment_count: available_parallelism()
54-
.map_or(4, |c| max(4, c.get() / 4)),
55-
..COMPACT_CONFIG
56-
})
57-
});
58-
this.compact_join_handle.get_mut().replace(handle);
59-
}
60-
Ok(this)
48+
})
6149
}
6250
}
6351

0 commit comments

Comments
 (0)