From 8bc3ccb9017b04aafccafa294f219ced5b41a372 Mon Sep 17 00:00:00 2001 From: Kevin Kuehler Date: Mon, 28 Oct 2019 12:07:07 -0700 Subject: Add manual threading to the pipeline Signed-off-by: Kevin Kuehler --- lib/msgstore.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/msgstore.go b/lib/msgstore.go index ccde2c2..bc55255 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -171,6 +171,15 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { case *types.DirectoryInfo: store.DirInfo = *msg.Info if store.thread { + store.worker.PostAction(&types.FetchNativeThreadSupport{}, nil) + } else { + store.worker.PostAction(&types.FetchDirectoryContents{ + SortCriteria: store.defaultSortCriteria, + }, nil) + } + update = true + case *types.NativeThreadSupport: + if msg.HasSupport { store.worker.PostAction(&types.FetchDirectoryThreaded{ SortCriteria: store.defaultSortCriteria, }, nil) @@ -178,8 +187,8 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { store.worker.PostAction(&types.FetchDirectoryContents{ SortCriteria: store.defaultSortCriteria, }, nil) + update = true } - update = true case *types.DirectoryThreaded: var ( uids []uint32 @@ -190,7 +199,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { msg.ThreadRoot.Traverse(false, func(t *types.Thread) bool { uid := t.Uid uids = append([]uint32{uid}, uids...) - flattened = append([]*types.Thread{t}, flattened...) + flattened = append(flattened, t) if msg, ok := store.Messages[uid]; ok { newMap[uid] = msg } else { -- cgit v1.2.3