Micro-optimization

This commit is contained in:
Matteo Settenvini 2023-05-02 18:19:45 +02:00
parent b2ecb115c0
commit 8489d8bb20
Signed by: matteo
GPG Key ID: CCF27A3AD054D593
1 changed files with 4 additions and 1 deletions

View File

@ -58,7 +58,10 @@ impl MessageService {
let tx_guard = self.shared_tx.lock().unwrap();
let maybe_tx = tx_guard.borrow().upgrade();
match maybe_tx {
Some(tx) => (tx.clone(), tx.subscribe()),
Some(tx) => {
let rx = tx.subscribe();
(tx, rx)
}
None => {
let (tx, rx) = broadcast::channel(MESSAGE_QUEUE_SIZE);
let tx = Arc::new(tx);