mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
Change tui tx_pool lock to try_read, only lock once (#3063)
This commit is contained in:
parent
142dfb10ac
commit
f86eb18a6e
1 changed files with 10 additions and 2 deletions
|
@ -475,9 +475,17 @@ impl Server {
|
|||
.map(|p| PeerStats::from_peer(&p))
|
||||
.collect();
|
||||
|
||||
let (tx_pool_size, stem_pool_size) = {
|
||||
let tx_pool_lock = self.tx_pool.try_read();
|
||||
match tx_pool_lock {
|
||||
Some(l) => (l.txpool.entries.len(), l.stempool.entries.len()),
|
||||
None => (0, 0),
|
||||
}
|
||||
};
|
||||
|
||||
let tx_stats = TxStats {
|
||||
tx_pool_size: self.tx_pool.read().txpool.entries.len(),
|
||||
stem_pool_size: self.tx_pool.read().stempool.entries.len(),
|
||||
tx_pool_size,
|
||||
stem_pool_size,
|
||||
};
|
||||
|
||||
let head = self.chain.head_header()?;
|
||||
|
|
Loading…
Reference in a new issue