add update duration print out
This commit is contained in:
parent
80541fe978
commit
6e449088a0
1 changed files with 8 additions and 2 deletions
|
@ -16,7 +16,7 @@ use serde::export::Formatter;
|
|||
use serde_json::Value;
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::time::UNIX_EPOCH;
|
||||
use std::time::{Instant, UNIX_EPOCH};
|
||||
use std::{fs, iter};
|
||||
use uuid::Uuid;
|
||||
use walkdir::WalkDir;
|
||||
|
@ -297,6 +297,8 @@ pub async fn reimport_directory(pool: DbPool, directory: PathBuf) {
|
|||
}
|
||||
}
|
||||
fn _reimport_directory<T: AsRef<Path>>(pool: DbPool, directory: T) -> Result<Vec<Result<()>>> {
|
||||
let start = Instant::now();
|
||||
|
||||
let path_entries: Vec<PathBuf> = WalkDir::new(&directory)
|
||||
.into_iter()
|
||||
.filter_map(|e| e.ok())
|
||||
|
@ -335,7 +337,11 @@ fn _reimport_directory<T: AsRef<Path>>(pool: DbPool, directory: T) -> Result<Vec
|
|||
})
|
||||
.collect();
|
||||
|
||||
info!("Finished updating {}.", directory.as_ref().display());
|
||||
info!(
|
||||
"Finished updating {}. Took {}s.",
|
||||
directory.as_ref().display(),
|
||||
start.elapsed().as_secs()
|
||||
);
|
||||
|
||||
Ok(path_results
|
||||
.into_iter()
|
||||
|
|
Loading…
Reference in a new issue