Skip to content

Commit

Permalink
fix(graph): make barrier more robust (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyannyacha authored Jan 15, 2025
1 parent 085c61e commit c8f8a7b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions crates/graph/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,21 @@ impl EszipDataSection {
pub async fn read_data_section_all(self: Arc<Self>) -> Result<(), ParseError> {
// NOTE: Below codes is roughly originated from [email protected]/src/v2.rs

let this = {
let sem = self.read_all_barrier.clone();
let sem = self.read_all_barrier.clone();
let this = loop {
let permit = sem
.acquire_many(READ_ALL_BARRIER_MAX_PERMITS as u32)
.await
.unwrap();

let this = Arc::into_inner(self).unwrap();

sem.close();
drop(permit);
this
if Arc::strong_count(&self) != 1 {
drop(permit);
tokio::task::yield_now().await;
continue;
} else {
sem.close();
break Arc::into_inner(self).unwrap();
}
};

let modules = this.modules;
Expand Down

0 comments on commit c8f8a7b

Please sign in to comment.