Micro-optimization
This commit is contained in:
parent
b2ecb115c0
commit
8489d8bb20
|
@ -58,7 +58,10 @@ impl MessageService {
|
||||||
let tx_guard = self.shared_tx.lock().unwrap();
|
let tx_guard = self.shared_tx.lock().unwrap();
|
||||||
let maybe_tx = tx_guard.borrow().upgrade();
|
let maybe_tx = tx_guard.borrow().upgrade();
|
||||||
match maybe_tx {
|
match maybe_tx {
|
||||||
Some(tx) => (tx.clone(), tx.subscribe()),
|
Some(tx) => {
|
||||||
|
let rx = tx.subscribe();
|
||||||
|
(tx, rx)
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
let (tx, rx) = broadcast::channel(MESSAGE_QUEUE_SIZE);
|
let (tx, rx) = broadcast::channel(MESSAGE_QUEUE_SIZE);
|
||||||
let tx = Arc::new(tx);
|
let tx = Arc::new(tx);
|
||||||
|
|
Loading…
Reference in New Issue