Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit b9c1382

Browse files
mergify[bot]lijunwangs
authored andcommitted
v1.18: Disable cache warmer if RPC is not using it (backport of #1063) (#1068)
Disable connection cache warmer for tpu if no rpc services using it. (cherry picked from commit d87e23d) # Conflicts: # core/src/tvu.rs * Merge conflicts --------- Co-authored-by: Lijun Wang <[email protected]>
1 parent 4ede51d commit b9c1382

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

core/src/tvu.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl Tvu {
135135
wait_to_vote_slot: Option<Slot>,
136136
accounts_background_request_sender: AbsRequestSender,
137137
log_messages_bytes_limit: Option<usize>,
138-
connection_cache: &Arc<ConnectionCache>,
138+
connection_cache: Option<&Arc<ConnectionCache>>,
139139
prioritization_fee_cache: &Arc<PrioritizationFeeCache>,
140140
banking_tracer: Arc<BankingTracer>,
141141
turbine_quic_endpoint_sender: AsyncSender<(SocketAddr, Bytes)>,
@@ -276,16 +276,19 @@ impl Tvu {
276276
tower_storage,
277277
);
278278

279-
let warm_quic_cache_service = if connection_cache.use_quic() {
280-
Some(WarmQuicCacheService::new(
281-
connection_cache.clone(),
282-
cluster_info.clone(),
283-
poh_recorder.clone(),
284-
exit.clone(),
285-
))
286-
} else {
287-
None
288-
};
279+
let warm_quic_cache_service = connection_cache.and_then(|connection_cache| {
280+
if connection_cache.use_quic() {
281+
Some(WarmQuicCacheService::new(
282+
connection_cache.clone(),
283+
cluster_info.clone(),
284+
poh_recorder.clone(),
285+
exit.clone(),
286+
))
287+
} else {
288+
None
289+
}
290+
});
291+
289292
let (cost_update_sender, cost_update_receiver) = unbounded();
290293
let cost_update_service = CostUpdateService::new(blockstore.clone(), cost_update_receiver);
291294

@@ -498,7 +501,7 @@ pub mod tests {
498501
None,
499502
AbsRequestSender::default(),
500503
None,
501-
&Arc::new(ConnectionCache::new("connection_cache_test")),
504+
Some(&Arc::new(ConnectionCache::new("connection_cache_test"))),
502505
&ignored_prioritization_fee_cache,
503506
BankingTracer::new_disabled(),
504507
turbine_quic_endpoint_sender,

core/src/validator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ impl Validator {
13061306
config.wait_to_vote_slot,
13071307
accounts_background_request_sender,
13081308
config.runtime_config.log_messages_bytes_limit,
1309-
&connection_cache,
1309+
json_rpc_service.is_some().then_some(&connection_cache), // for the cache warmer only used for STS for RPC service
13101310
&prioritization_fee_cache,
13111311
banking_tracer.clone(),
13121312
turbine_quic_endpoint_sender.clone(),

0 commit comments

Comments
 (0)