@@ -171,6 +171,11 @@ pub struct EnvVarsStore {
171171 /// Disables storing or reading `eth_call` results from the store call cache.
172172 /// Set by `GRAPH_STORE_DISABLE_CALL_CACHE`. Defaults to false.
173173 pub disable_call_cache : bool ,
174+ /// The number of contracts to delete from the call cache in one batch
175+ /// when clearing stale entries, set by
176+ /// `GRAPH_STORE_STALE_CALL_CACHE_CONTRACTS_BATCH_SIZE`. The default
177+ /// value is 100 contracts.
178+ pub stale_call_cache_contracts_batch_size : usize ,
174179 /// Set by `GRAPH_STORE_DISABLE_CHAIN_HEAD_PTR_CACHE`. Default is false.
175180 /// Set to true to disable chain_head_ptr caching (safety escape hatch).
176181 pub disable_chain_head_ptr_cache : bool ,
@@ -248,6 +253,7 @@ impl TryFrom<InnerStore> for EnvVarsStore {
248253 account_like_min_versions_count : x. account_like_min_versions_count ,
249254 account_like_max_unique_ratio : x. account_like_max_unique_ratio . map ( |r| r. 0 ) ,
250255 disable_call_cache : x. disable_call_cache ,
256+ stale_call_cache_contracts_batch_size : x. stale_call_cache_contracts_batch_size ,
251257 disable_chain_head_ptr_cache : x. disable_chain_head_ptr_cache ,
252258 connection_validation_idle_secs : Duration :: from_secs ( x. connection_validation_idle_secs ) ,
253259 connection_unavailable_retry : Duration :: from_secs (
@@ -364,6 +370,11 @@ pub struct InnerStore {
364370 account_like_max_unique_ratio : Option < ZeroToOneF64 > ,
365371 #[ envconfig( from = "GRAPH_STORE_DISABLE_CALL_CACHE" , default = "false" ) ]
366372 disable_call_cache : bool ,
373+ #[ envconfig(
374+ from = "GRAPH_STORE_STALE_CALL_CACHE_CONTRACTS_BATCH_SIZE" ,
375+ default = "100"
376+ ) ]
377+ stale_call_cache_contracts_batch_size : usize ,
367378 #[ envconfig( from = "GRAPH_STORE_DISABLE_CHAIN_HEAD_PTR_CACHE" , default = "false" ) ]
368379 disable_chain_head_ptr_cache : bool ,
369380 #[ envconfig( from = "GRAPH_STORE_CONNECTION_VALIDATION_IDLE_SECS" , default = "30" ) ]
0 commit comments