Don't send Done until finished fetching messages
This commit is contained in:
parent
a81467dda9
commit
e85ef71935
|
@ -47,6 +47,7 @@ func (imapw *IMAPWorker) handleFetchMessages(
|
||||||
section *imap.BodySectionName) {
|
section *imap.BodySectionName) {
|
||||||
|
|
||||||
messages := make(chan *imap.Message)
|
messages := make(chan *imap.Message)
|
||||||
|
done := make(chan interface{})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for _msg := range messages {
|
for _msg := range messages {
|
||||||
|
@ -77,6 +78,7 @@ func (imapw *IMAPWorker) handleFetchMessages(
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
done <- nil
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := imapw.client.UidFetch(uids, items, messages); err != nil {
|
if err := imapw.client.UidFetch(uids, items, messages); err != nil {
|
||||||
|
@ -85,6 +87,7 @@ func (imapw *IMAPWorker) handleFetchMessages(
|
||||||
Error: err,
|
Error: err,
|
||||||
}, nil)
|
}, nil)
|
||||||
} else {
|
} else {
|
||||||
|
<-done
|
||||||
imapw.worker.PostMessage(
|
imapw.worker.PostMessage(
|
||||||
&types.Done{types.RespondTo(msg)}, nil)
|
&types.Done{types.RespondTo(msg)}, nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue