MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / spawn_refresh_worker

Function spawn_refresh_worker

crates/openshell-server/src/provider_refresh.rs:683–698  ·  view source on GitHub ↗
(state: std::sync::Arc<crate::ServerState>, interval: Duration)

Source from the content-addressed store, hash-verified

681}
682
683pub fn spawn_refresh_worker(state: std::sync::Arc<crate::ServerState>, interval: Duration) {
684 info!(
685 interval_seconds = interval.as_secs(),
686 "provider credential refresh worker started"
687 );
688 tokio::spawn(async move {
689 let mut ticker = tokio::time::interval(interval);
690 ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
691 loop {
692 ticker.tick().await;
693 if let Err(err) = run_refresh_worker_tick(state.store.as_ref()).await {
694 warn!(error = %err, "provider credential refresh worker tick failed");
695 }
696 }
697 });
698}
699
700async fn run_refresh_worker_tick(store: &Store) -> Result<(), Status> {
701 let now_ms = current_time_ms();

Callers 1

run_serverFunction · 0.85

Calls 2

run_refresh_worker_tickFunction · 0.85
spawnFunction · 0.50

Tested by

no test coverage detected