summary refs log tree commit diff stats
path: root/worker/imap
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-02 13:29:40 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-02 13:29:40 -0400
commit3a5b4c229e42c14b1389cd985506d09b3f17388b (patch)
treec11c1e50a6dd2fafda87480248c4764adfc25a11 /worker/imap
parente85ef71935c145307b67cf6af2477d1c2d041075 (diff)
downloadaerc-3a5b4c229e42c14b1389cd985506d09b3f17388b.tar.gz
Wait for listing to complete before sending Done
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/list.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 6aecbca..5e282ef 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -9,6 +9,7 @@ import (
 func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
 	mailboxes := make(chan *imap.MailboxInfo)
 	imapw.worker.Logger.Println("Listing mailboxes")
+	done := make(chan interface{})
 
 	go func() {
 		for mbox := range mailboxes {
@@ -22,9 +23,11 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
 				Attributes: mbox.Attributes,
 			}, nil)
 		}
+		done <- nil
 	}()
 
 	if err := imapw.client.List("", "*", mailboxes); err != nil {
+		<-done
 		imapw.worker.PostMessage(&types.Error{
 			Message: types.RespondTo(msg),
 			Error:   err,
re>9ef2a57 ^
2dc4365 ^




6fed04b ^


b5d5e0d ^
6fed04b ^
d24e471 ^
6394e38 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31