From 6e449088a01374b8897849763393f9f0539b493b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 23 Sep 2020 23:11:50 +0200 Subject: [PATCH] add update duration print out --- src/filesystem.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/filesystem.rs b/src/filesystem.rs index 8266e60..27b8a02 100644 --- a/src/filesystem.rs +++ b/src/filesystem.rs @@ -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>(pool: DbPool, directory: T) -> Result>> { + let start = Instant::now(); + let path_entries: Vec = WalkDir::new(&directory) .into_iter() .filter_map(|e| e.ok()) @@ -335,7 +337,11 @@ fn _reimport_directory>(pool: DbPool, directory: T) -> Result