Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck committed Jul 27, 2023
1 parent af05140 commit 59508cf
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mobile_verifier/src/speedtests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,15 @@ impl SpeedtestDaemon {
// below is an o(n) op but the vec size will be limited
// todo: consider alternative
if !gateways_to_average.contains(&pubkey) {
&gateways_to_average.push(pubkey)
} else {
&()
};
};
gateways_to_average.push(pubkey)
}
}
Ok((gateways_to_average, transaction))
},
)
.await?;
// commit the speedtests to the db
transaction.commit().await?;

// the processed speedtests are committed to the DB
// so now calculate the latest averages for each gateway
// from which we recevied a new and valid speedtest
let averages_transaction = self.pool.begin().await?;
stream::iter(gateways_to_average)
.map(anyhow::Ok)
Expand All @@ -150,8 +144,8 @@ impl SpeedtestDaemon {
.await?
.commit()
.await?;

self.file_sink.commit().await?;

Ok(())
}
}
Expand Down

0 comments on commit 59508cf

Please sign in to comment.