Skip to content

Commit

Permalink
fix: Seen circuits may be accepted again
Browse files Browse the repository at this point in the history
  • Loading branch information
lmondada committed Oct 4, 2023
1 parent b699553 commit 95dc9af
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/optimiser/taso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ where
let rewrites = self.rewriter.get_rewrites(&circ);
for new_circ in self.strategy.apply_rewrites(rewrites, &circ) {
let new_circ_hash = new_circ.circuit_hash();
circ_cnt += 1;
logger.log_progress(circ_cnt, Some(pq.len()), seen_hashes.len());
if seen_hashes.contains(&new_circ_hash) {
continue;
}
circ_cnt += 1;
pq.push_with_hash_unchecked(new_circ, new_circ_hash);
seen_hashes.insert(new_circ_hash);
}
Expand Down Expand Up @@ -239,16 +239,13 @@ where
select! {
recv(rx_result) -> msg => {
match msg {
Ok(hashed_circs) => {
Ok(mut hashed_circs) => {
let send_result = tracing::trace_span!(target: "taso::metrics", "recv_result").in_scope(|| {
jobs_completed += 1;
for (circ_hash, circ) in &hashed_circs {
hashed_circs.retain(|&(hash, _)| seen_hashes.insert(hash));
for (_, circ) in &hashed_circs {
logger.log_progress(circ_cnt, None, seen_hashes.len());
circ_cnt += 1;
logger.log_progress(circ_cnt, None, seen_hashes.len());
if seen_hashes.contains(circ_hash) {
continue;
}
seen_hashes.insert(*circ_hash);

let cost = self.cost(circ);

Expand Down

0 comments on commit 95dc9af

Please sign in to comment.