修改deploy

This commit is contained in:
xiuting.xu
2026-04-24 11:33:54 +08:00
parent 8a65f639cb
commit 88c11e7a97
4 changed files with 43 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
use std::env;
use std::net::SocketAddr;
use std::sync::{Arc, RwLock};
use std::time::Duration;
use std::time::{Duration, Instant};
use anyhow::{Result, anyhow};
use chrono::{FixedOffset, Utc};
@@ -284,13 +284,29 @@ fn init_shared_cache(config: &AppConfig, store: &RtrStore) -> Result<SharedRtrCa
slurm_dir: config.slurm_dir.clone(),
strict_ccr_validation: config.strict_ccr_validation,
};
let source_to_delta_started = Instant::now();
let initial_cache = RtrCache::default().init(
store,
config.max_delta,
config.prune_delta_by_snapshot_size,
config.timing,
|| load_payloads_from_latest_sources(&payload_load_config),
|| {
let payloads = load_payloads_from_latest_sources(&payload_load_config)?;
info!(
"RTR source-to-delta timing: phase=startup_load_complete, ccr_dir={}, payload_count={}, elapsed_ms={}",
payload_load_config.ccr_dir,
payloads.len(),
source_to_delta_started.elapsed().as_millis()
);
Ok(payloads)
},
)?;
info!(
"RTR source-to-delta timing: phase=startup_cache_init_complete, ccr_dir={}, serials={:?}, elapsed_ms={}",
payload_load_config.ccr_dir,
initial_cache.serials(),
source_to_delta_started.elapsed().as_millis()
);
let shared_cache: SharedRtrCache = Arc::new(RwLock::new(initial_cache));
@@ -369,6 +385,7 @@ fn spawn_refresh_task(
loop {
interval.tick().await;
let source_to_delta_started = Instant::now();
match load_payloads_from_latest_sources(&payload_load_config) {
Ok(payloads) => {
@@ -410,6 +427,13 @@ fn spawn_refresh_task(
}
}
};
info!(
"RTR source-to-delta timing: phase=refresh_cache_update_complete, ccr_dir={}, payload_count={}, changed={}, elapsed_ms={}",
payload_load_config.ccr_dir,
payload_count,
updated,
source_to_delta_started.elapsed().as_millis()
);
if updated {
notifier.notify_cache_updated();
@@ -418,8 +442,10 @@ fn spawn_refresh_task(
}
Err(err) => {
warn!(
"failed to reload CCR/SLURM payloads from {}: {:?}",
payload_load_config.ccr_dir, err
"failed to reload CCR/SLURM payloads from {}: {:?} (source_to_delta_elapsed_ms={})",
payload_load_config.ccr_dir,
err,
source_to_delta_started.elapsed().as_millis()
);
}
}