Skip to content

Commit

Permalink
simplify warm_quic_cache_service instantiation (#1063)
Browse files Browse the repository at this point in the history
* simplify warm_quic_cache_service instantiation
  • Loading branch information
lijunwangs committed Apr 26, 2024
1 parent 67f21d9 commit d87e23d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions core/src/tvu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,19 @@ impl Tvu {
tower_storage,
);

let connection_cache_use_quic = connection_cache.map(|cc| cc.use_quic()).unwrap_or(false);
let warm_quic_cache_service = if connection_cache_use_quic {
Some(WarmQuicCacheService::new(
connection_cache.unwrap().clone(),
cluster_info.clone(),
poh_recorder.clone(),
exit.clone(),
))
} else {
None
};
let warm_quic_cache_service = connection_cache.and_then(|connection_cache| {
if connection_cache.use_quic() {
Some(WarmQuicCacheService::new(
connection_cache.clone(),
cluster_info.clone(),
poh_recorder.clone(),
exit.clone(),
))
} else {
None
}
});

let (cost_update_sender, cost_update_receiver) = unbounded();
let cost_update_service = CostUpdateService::new(blockstore.clone(), cost_update_receiver);

Expand Down

0 comments on commit d87e23d

Please sign in to comment.