@@ -149,7 +149,7 @@ struct Config {
149
149
pub oracle_index : Option < u64 > ,
150
150
}
151
151
152
- const DEPLOYMENT_CACHE_TTL : Duration = Duration :: from_secs ( 60 * 60 * 24 ) ;
152
+ const VALID_DEPLOYMENT_CACHE_TTL : Duration = Duration :: from_secs ( 60 * 60 * 24 ) ;
153
153
154
154
#[ tokio:: main]
155
155
async fn main ( ) -> Result < ( ) > {
@@ -189,8 +189,8 @@ async fn run(logger: Logger, config: Config) -> Result<()> {
189
189
let mut interval = tokio:: time:: interval ( config. period ) ;
190
190
interval. set_missed_tick_behavior ( MissedTickBehavior :: Skip ) ;
191
191
192
- // Valid deployments get checked only every DEPLOYMENT_CACHE_TTL seconds
193
- let mut deployment_cache : Vec < ( Cid , SystemTime ) > = Vec :: new ( ) ;
192
+ // Valid deployments get checked only every VALID_DEPLOYMENT_CACHE_TTL seconds
193
+ let mut valid_deployment_cache : Vec < ( Cid , SystemTime ) > = Vec :: new ( ) ;
194
194
195
195
loop {
196
196
interval. tick ( ) . await ;
@@ -208,15 +208,15 @@ async fn run(logger: Logger, config: Config) -> Result<()> {
208
208
grace_period,
209
209
epoch_subgraph. clone ( ) ,
210
210
& config. supported_data_source_kinds ,
211
- deployment_cache . clone ( ) ,
211
+ valid_deployment_cache . clone ( ) ,
212
212
)
213
213
. await
214
214
{
215
215
Ok ( updated_deployment_cache) => {
216
216
METRICS . reconcile_runs_ok . inc ( ) ;
217
- deployment_cache = updated_deployment_cache;
217
+ valid_deployment_cache = updated_deployment_cache;
218
218
info ! ( logger, "Deployment cache updated" ;
219
- "count" => deployment_cache . len( )
219
+ "count" => valid_deployment_cache . len( )
220
220
) ;
221
221
}
222
222
Err ( e) => {
@@ -302,7 +302,7 @@ pub async fn reconcile_deny_list(
302
302
grace_period : Duration ,
303
303
epoch_subgraph : Arc < impl EpochBlockOracleSubgraph > ,
304
304
supported_ds_kinds : & [ String ] ,
305
- deployment_cache : Vec < ( Cid , SystemTime ) > ,
305
+ valid_deployment_cache : Vec < ( Cid , SystemTime ) > ,
306
306
) -> Result < Vec < ( Cid , SystemTime ) > , Error > {
307
307
let logger = logger. clone ( ) ;
308
308
@@ -328,16 +328,16 @@ pub async fn reconcile_deny_list(
328
328
let deployment = deployment?;
329
329
let id = bytes32_to_cid_v0 ( deployment. id ) ;
330
330
331
- // Valid subgraphs are only checked every DEPLOYMENT_CACHE_TTL seconds to reduce IPFS requests
332
- let cached = deployment_cache
331
+ // Valid subgraphs are only checked every VALID_DEPLOYMENT_CACHE_TTL seconds to reduce IPFS requests
332
+ let cached = valid_deployment_cache
333
333
. iter ( )
334
334
. filter ( |( _, last_validated) | {
335
- last_validated. elapsed ( ) . unwrap ( ) < DEPLOYMENT_CACHE_TTL
335
+ last_validated. elapsed ( ) . unwrap ( ) < VALID_DEPLOYMENT_CACHE_TTL
336
336
} )
337
337
. find ( |( cid, _) | * cid == id) ;
338
338
339
339
if cached. is_some ( ) {
340
- METRICS . deployment_cache_hits . inc ( ) ;
340
+ METRICS . valid_deployment_cache_hits . inc ( ) ;
341
341
return Ok ( ( deployment, Valid :: Yes , cached. unwrap ( ) . 1 ) ) ;
342
342
} else {
343
343
let validity = match check ( ipfs, id, & supported_networks, supported_ds_kinds) . await
@@ -591,7 +591,7 @@ struct Metrics {
591
591
reconcile_runs_total : prometheus:: IntCounter ,
592
592
reconcile_runs_ok : prometheus:: IntCounter ,
593
593
reconcile_runs_err : prometheus:: IntCounter ,
594
- deployment_cache_hits : prometheus:: IntCounter ,
594
+ valid_deployment_cache_hits : prometheus:: IntCounter ,
595
595
}
596
596
597
597
lazy_static ! {
@@ -616,9 +616,9 @@ impl Metrics {
616
616
"Total reconcile runs with errors"
617
617
)
618
618
. unwrap ( ) ,
619
- deployment_cache_hits : prometheus:: register_int_counter!(
620
- "deployment_cache_hits " ,
621
- "Total deployment cache hits"
619
+ valid_deployment_cache_hits : prometheus:: register_int_counter!(
620
+ "valid_deployment_cache_hits " ,
621
+ "Total valid deployment cache hits"
622
622
)
623
623
. unwrap ( ) ,
624
624
}
0 commit comments