From 80a13ec7073d097dc7d251591e9b47156ad981e7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 6 Jan 2020 17:56:15 +0100 Subject: Add more debugging Signed-off-by: Matthias Beyer --- lib/domain/libimagmail/src/mailtree.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/domain/libimagmail/src/mailtree.rs b/lib/domain/libimagmail/src/mailtree.rs index bec50f9e..1ac63350 100644 --- a/lib/domain/libimagmail/src/mailtree.rs +++ b/lib/domain/libimagmail/src/mailtree.rs @@ -57,22 +57,30 @@ fn fill_arena_with<'a>(arena: &mut Arena, store: &'a MailStoreWithConnec let root_node = arena.new_node(root_id); store.connection().execute(|db| { - let query = db.create_query(&format!("thread:{}", root.get_thread_id()))?; + let q = format!("thread:{}", root.get_thread_id()); + trace!("Executing query: {}", q); + let query = db.create_query(&q)?; let r = query.search_threads()? .map(|thread| { + trace!("Found thread: {}", thread.id()); thread.messages() .map(|msg| { let id = msg.id(); - trace!("Processing {} reply: {}", root.get_id(), id); + trace!("Found Message: {}", id); + let mail = store.get_mail_by_id(&id)? .ok_or_else(|| format_err!("Cannot find mail for id {}", id))?; + trace!("Fetched from store: {}", mail.get_location()); let reply = mail .load(store.connection())? .ok_or_else(|| format_err!("Tried to load unavailable mail: {}", mail.get_location()))?; + trace!("Loaded from store: {}", reply.get_id()); let new_node_id = arena.new_node(id.into_owned()); root_node.append(new_node_id, arena); + + trace!("Recursing with: {}", reply.get_id()); fill_arena_with(arena, store, reply).map(|_| ()) }) .collect::>>() -- cgit v1.2.3