Skip to content

Commit

Permalink
Only initialize default config once
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 15, 2023
1 parent 5194ebb commit f41eb05
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,19 @@ where

match storage.read("config").await {
Ok(mut config) => match config.read_loadable::<ConfigFile>(storage).await {
Ok(config) => CONFIG.init(config.into_config()),
Ok(config) => return CONFIG.init(config.into_config()),
Err(e) => {
warn!("Failed to read config file: {:?}. Reverting to defaults", e);
CONFIG.init(Config::default())
}
},
Err(e) => {
warn!("Failed to load config: {:?}. Reverting to defaults", e);
CONFIG.init(Config::default())
}
}
} else {
warn!("Storage unavailable. Using default config");
CONFIG.init(Config::default())
}
CONFIG.init(Config::default())
}

async fn saved_measurement_exists<M>(storage: &mut Storage<M>) -> bool
Expand Down

0 comments on commit f41eb05

Please sign in to comment.