Skip to content

Commit 31b8f12

Browse files
committed
Turbopack: use block_in_place for db reads
1 parent 9490832 commit 31b8f12

File tree

1 file changed

+12
-2
lines changed
  • turbopack/crates/turbo-persistence/src

1 file changed

+12
-2
lines changed

turbopack/crates/turbo-persistence/src/db.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,22 @@ impl<S: ParallelScheduler> TurboPersistence<S> {
11521152

11531153
/// Get a value from the database. Returns None if the key is not found. The returned value
11541154
/// might hold onto a block of the database and it should not be hold long-term.
1155-
pub fn get<K: QueryKey>(&self, family: usize, key: &K) -> Result<Option<ArcSlice<u8>>> {
1155+
pub fn get<K: QueryKey + Sync>(&self, family: usize, key: &K) -> Result<Option<ArcSlice<u8>>> {
11561156
let hash = hash_key(key);
1157+
self.parallel_scheduler
1158+
.block_in_place(|| self.get_inner(family as u32, hash, key))
1159+
}
1160+
1161+
fn get_inner<K: QueryKey>(
1162+
&self,
1163+
family: u32,
1164+
hash: u64,
1165+
key: &K,
1166+
) -> Result<Option<ArcSlice<u8>>> {
11571167
let inner = self.inner.read();
11581168
for meta in inner.meta_files.iter().rev() {
11591169
match meta.lookup(
1160-
family as u32,
1170+
family,
11611171
hash,
11621172
key,
11631173
&self.amqf_cache,

0 commit comments

Comments
 (0)