thunderbird / thunderbird-android

Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail)
https://thunderbird.net/mobile
Apache License 2.0
10.85k stars 2.51k forks source link

not concurrent connections during sync/pull #2295

Open woj-tek opened 7 years ago

woj-tek commented 7 years ago

Expected behavior

All accounts and mailboxes are checked one-by-one (or at least how it looks like judging from the status in the main window) during Pull (push/idle works differently and it seems that notifications are generated concurrently)

Actual behavior

They should be checked at the same time

Steps to reproduce

  1. open the app with multiple accounts/mailboxes
  2. hit "sync"

Environment

K-9 Mail version:5.203

Android version:6.0.1

Account type (IMAP, POP3, WebDAV/Exchange): 3x IMAP

philipwhiuk commented 7 years ago

We currently have a push connection per folder, one polling connection and one sync connection I think.

We need to be careful regarding connection limits but I definitely think we could synchronise multiple accounts at the same time. There's existing discussion been had about making MessagingController more intelligent and this fits nicely with that.

woj-tek commented 7 years ago

Well, I've tried searching for relevant issues but failed to find such so I've created this one.

I'm aware about the limitations and restrictions of connection number so here is my use case:

kokoko3k commented 7 years ago

I was about to open another "issue", but slightly different from this one. I use k9mail to sync my gmail account, and i syncronize inbox folder and sent folder. To spare some battery juice, it would be nice if k9 would be able to to do both pulls in a single shot.

philipwhiuk commented 7 years ago

@kokoko3k Change the 'Sync class' for the Sent folder in Folder settings to 1st Class.

kokoko3k commented 7 years ago

They already are 1st class, both inbox and sent. Still, k9 first pulls inbox, then pulls sent folder (in italian is "Posta inviata", here's the logcat output:

03-24 11:10:15.571 I/k9      ( 3180): Running command 'checkMail', seq = 22(backgroundpriority)
03-24 11:10:15.577 I/k9      ( 3180): Running command 'sendPendingMessages', seq = 23(backgroundpriority)
03-24 11:10:15.579 I/k9      ( 3180): Running command 'syncINBOX', seq = 24(backgroundpriority)
03-24 11:10:17.690 I/k9      ( 3180): Running command 'sync[Gmail]/Posta inviata', seq = 25(backgroundpriority)
03-24 11:10:18.358 I/k9      ( 3180): Running command 'clear notification flag for myemail@gmail.com', seq = 26(backgroundpriority)
03-24 11:10:18.373 I/k9      ( 3180): Running command 'finalize sync', seq = 27(backgroundpriority)
[..]
03-24 11:11:18.484 I/k9      ( 3180): Running command 'checkMail', seq = 28(backgroundpriority)
03-24 11:11:18.492 I/k9      ( 3180): Running command 'sendPendingMessages', seq = 29(backgroundpriority)
03-24 11:11:18.496 I/k9      ( 3180): Running command 'syncINBOX', seq = 30(backgroundpriority)
03-24 11:11:20.797 I/k9      ( 3180): Running command 'sync[Gmail]/Posta inviata', seq = 31(backgroundpriority)
03-24 11:11:21.736 I/k9      ( 3180): Running command 'clear notification flag for myemail@gmail.com', seq = 32(backgroundpriority)
03-24 11:11:21.751 I/k9      ( 3180): Running command 'finalize sync', seq = 33(backgroundpriority)
[..]
03-24 11:12:21.837 I/k9      ( 3180): Running command 'checkMail', seq = 34(backgroundpriority)
03-24 11:12:21.847 I/k9      ( 3180): Running command 'sendPendingMessages', seq = 35(backgroundpriority)
03-24 11:12:21.850 I/k9      ( 3180): Running command 'syncINBOX', seq = 36(backgroundpriority)
03-24 11:12:23.895 I/k9      ( 3180): Running command 'sync[Gmail]/Posta inviata', seq = 37(backgroundpriority)
03-24 11:12:24.653 I/k9      ( 3180): Running command 'clear notification flag for myemail@gmail.com', seq = 38(backgroundpriority)
03-24 11:12:24.694 I/k9      ( 3180): Running command 'finalize sync', seq = 39(backgroundpriority)

As you can see, "sent-box poll" (Posta inviata) comes after "inbox poll" has finished, i was talking about parallelizing, because sometimes the pull process takes a lot of time to complete (for reasons i ignore, maybe is gmail itself).

philipwhiuk commented 7 years ago

Oh right yep, that's the function of this ticket.

glocalglocal commented 3 years ago

This is more of an issue when one of several mailservers is very slow or in trouble and you have to wait until it times out before K9mail can get to the next one. That's exactly what I've been getting for years with two out of the six servers I poll manually.