Skip to content

Commit 05bb802

Browse files
committed
chore: rename deployment_cache > valid_deployment_cache
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
1 parent 0a2321a commit 05bb802

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

availability-oracle/src/main.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct Config {
149149
pub oracle_index: Option<u64>,
150150
}
151151

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);
153153

154154
#[tokio::main]
155155
async fn main() -> Result<()> {
@@ -189,8 +189,8 @@ async fn run(logger: Logger, config: Config) -> Result<()> {
189189
let mut interval = tokio::time::interval(config.period);
190190
interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
191191

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();
194194

195195
loop {
196196
interval.tick().await;
@@ -208,15 +208,15 @@ async fn run(logger: Logger, config: Config) -> Result<()> {
208208
grace_period,
209209
epoch_subgraph.clone(),
210210
&config.supported_data_source_kinds,
211-
deployment_cache.clone(),
211+
valid_deployment_cache.clone(),
212212
)
213213
.await
214214
{
215215
Ok(updated_deployment_cache) => {
216216
METRICS.reconcile_runs_ok.inc();
217-
deployment_cache = updated_deployment_cache;
217+
valid_deployment_cache = updated_deployment_cache;
218218
info!(logger, "Deployment cache updated";
219-
"count" => deployment_cache.len()
219+
"count" => valid_deployment_cache.len()
220220
);
221221
}
222222
Err(e) => {
@@ -302,7 +302,7 @@ pub async fn reconcile_deny_list(
302302
grace_period: Duration,
303303
epoch_subgraph: Arc<impl EpochBlockOracleSubgraph>,
304304
supported_ds_kinds: &[String],
305-
deployment_cache: Vec<(Cid, SystemTime)>,
305+
valid_deployment_cache: Vec<(Cid, SystemTime)>,
306306
) -> Result<Vec<(Cid, SystemTime)>, Error> {
307307
let logger = logger.clone();
308308

@@ -328,16 +328,16 @@ pub async fn reconcile_deny_list(
328328
let deployment = deployment?;
329329
let id = bytes32_to_cid_v0(deployment.id);
330330

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
333333
.iter()
334334
.filter(|(_, last_validated)| {
335-
last_validated.elapsed().unwrap() < DEPLOYMENT_CACHE_TTL
335+
last_validated.elapsed().unwrap() < VALID_DEPLOYMENT_CACHE_TTL
336336
})
337337
.find(|(cid, _)| *cid == id);
338338

339339
if cached.is_some() {
340-
METRICS.deployment_cache_hits.inc();
340+
METRICS.valid_deployment_cache_hits.inc();
341341
return Ok((deployment, Valid::Yes, cached.unwrap().1));
342342
} else {
343343
let validity = match check(ipfs, id, &supported_networks, supported_ds_kinds).await
@@ -591,7 +591,7 @@ struct Metrics {
591591
reconcile_runs_total: prometheus::IntCounter,
592592
reconcile_runs_ok: prometheus::IntCounter,
593593
reconcile_runs_err: prometheus::IntCounter,
594-
deployment_cache_hits: prometheus::IntCounter,
594+
valid_deployment_cache_hits: prometheus::IntCounter,
595595
}
596596

597597
lazy_static! {
@@ -616,9 +616,9 @@ impl Metrics {
616616
"Total reconcile runs with errors"
617617
)
618618
.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"
622622
)
623623
.unwrap(),
624624
}

0 commit comments

Comments
 (0)