summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-01-06 17:56:15 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-01-06 18:26:28 +0100
commit80a13ec7073d097dc7d251591e9b47156ad981e7 (patch)
treed96bb0131228bee9ef31ce893e1f101e77f676f3
parentbf21ffb6d8cca0947f92184d2afc816eeaef5efd (diff)
Add more debugging
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/domain/libimagmail/src/mailtree.rs12
1 files 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<String>, 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::<Result<Vec<_>>>()