MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.59k stars 623 forks source link

[Bug] - fetchMessagesByNumberOperation runs on main thread, blocks UI #1916

Open golfingmateo opened 3 years ago

golfingmateo commented 3 years ago

Summary Trying to fetch messages and the operation is running on the main thread and blocking the UI Platform(s)

<MacOs>

Piece of code

DispatchQueue.global(qos: .background).async{
    let op = session.fetchMessagesByNumberOperation(withFolder: "INBOX", requestKind: kind, numbers: uids)
    print(Thread.isMainThread)
    op.callbackDispatchQueue = DispatchQueue.global(qos: .background)
    op.start({ _, _, _ in
       print(Thread.isMainThread)
    }
}

Actual outcome operation runs on main thread

Connection Logs

false
true

Expected outcome operation should run on background thread

Link to sample code on GitHub reproducing the issue (a full Xcode project):

https://