fmbiete / Z-Push-contrib

Z-Push fork with changes that I will try to contrib
GNU Affero General Public License v3.0
134 stars 62 forks source link

IMAPBackend: recurring notification of new mail for same mail item #235

Open chinenual opened 9 years ago

chinenual commented 9 years ago

Using latest - 80cbe53de4ab8dd598d1f2af6f0a23fa396c529a Previously had been using 80f3ed550ad2c8eacb18a5bbb6b18d01e2e8a606

iOS 9.0

Since updating zpush to 80cbe53de, I'm noticing that unread emails are causing recurring notifications. Instead of getting a popup notification once, I seem to get a notification for the same item every 10 or 15 minutes.

I've also noticed that when I manually "check for mail" by refreshing a folder, it appears to delete all messages, then re-download each item - rather than just downloading new mail. Even when there's no new mail in that folder, a refresh "deletes" all the items in the folder and then re-downloads them.

I'm guessing these behaviors are related (when the mail is re-downloaded, it triggers a notification on the iOS side).

What can I do to help debug this?

fmbiete commented 9 years ago

Can you make this changes in lib/core/synccollection.php and test?

//                    // ZP-631 - temporary disable checking validity of notifications
//                    // notify mobile for all received notifications
//                    $this->changes[$folderid] = 1;
//                    $validNotifications = true;
                     // check if the notification on the folder is within our filter
                     if ($this->CountChange($folderid)) {
                         ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s'", $folderid));
                         $validNotifications = true;
                         $this->waitingTime = time()-$started;
                     }
                     else {
                         ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Notification received on folder '%s', but it is not relevant", $folderid));
                     }
chinenual commented 9 years ago

I tried undoing the ZP-631 change as requested and... no change.

One additional observation: I have several folders set to Push notifications to the phone (I use procmail to deliver to multiple folders each treated as a separate "inbox"). I've only noticed this behavior on one of the folders. Other folders appear to behave normally (no erase and repaint when "refreshing" the folder, no recurring notifications for unread mail -- just in that one folder. maybe there's something I should be looking for in the log?

chinenual commented 9 years ago

More info - i switched back to 80f3ed5 as a sanity check -- and still see the same behavior! So this may be a data-driven problem rather than a coding problem. Not sure what to look for in the logs (I have WBXML enabled and it's a bit overwhelming :)). But I'll bet there's something in that folder that is causing the problem.

fmbiete commented 9 years ago

Umm... you should try the hard way then. Create a new folder, move one message from the problematic folder, sync, check for errors... and repeat until you catch the error. Sorry about that.