Skip to content

Commit ce650a6

Browse files
committed
Turbopack: use block_in_place for db reads
1 parent 92359d4 commit ce650a6

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
@@ -1161,12 +1161,22 @@ impl<S: ParallelScheduler> TurboPersistence<S> {
11611161

11621162
/// Get a value from the database. Returns None if the key is not found. The returned value
11631163
/// might hold onto a block of the database and it should not be hold long-term.
1164-
pub fn get<K: QueryKey>(&self, family: usize, key: &K) -> Result<Option<ArcSlice<u8>>> {
1164+
pub fn get<K: QueryKey + Sync>(&self, family: usize, key: &K) -> Result<Option<ArcSlice<u8>>> {
11651165
let hash = hash_key(key);
1166+
self.parallel_scheduler
1167+
.block_in_place(|| self.get_inner(family as u32, hash, key))
1168+
}
1169+
1170+
fn get_inner<K: QueryKey>(
1171+
&self,
1172+
family: u32,
1173+
hash: u64,
1174+
key: &K,
1175+
) -> Result<Option<ArcSlice<u8>>> {
11661176
let inner = self.inner.read();
11671177
for meta in inner.meta_files.iter().rev() {
11681178
match meta.lookup(
1169-
family as u32,
1179+
family,
11701180
hash,
11711181
key,
11721182
&self.amqf_cache,

0 commit comments

Comments
 (0)