Skip to content

Commit

Permalink
geocode: show geonames index age on successful load
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Dec 30, 2023
1 parent 7218208 commit e5c47a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/cmd/geocode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,15 @@ async fn load_engine(geocode_index_file: PathBuf, progressbar: &ProgressBar) ->
.load_from(geocode_index_file)
.map_err(|e| format!("On load index file: {e}"))?;

engine.metadata.as_ref().map(|m| {
let now = std::time::SystemTime::now();
let age = now.duration_since(m.created_at).unwrap();
progressbar.println(format!(
"Geonames index loaded. Age: {}",
indicatif::HumanDuration(age)
));
});

Ok(engine)
}

Expand Down Expand Up @@ -1934,10 +1943,7 @@ fn format_result(

/// get_countryinfo is a cached function that returns a countryinfo result for a given cell value.
/// It is used by the countryinfo/countryinfonow subcommands.
#[cached(
key = "String",
convert = r#"{ format!("{cell}-{formatstr}") }"#,
)]
#[cached(key = "String", convert = r#"{ format!("{cell}-{formatstr}") }"#)]
fn get_countryinfo(
engine: &Engine,
cell: &str,
Expand Down

0 comments on commit e5c47a3

Please sign in to comment.