Closed Bug 1210626 Opened 9 years ago Closed 9 years ago

Email sync with two 5 min syncs and one 60 min sync seems to only sync at 60 mins

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1213169

People

(Reporter: jrburke, Assigned: jrburke)

Details

Reported in IRC to me:

* Configure three accounts in email, two syncing at 5 minutes and one at 60 minutes (for the user all were imap accounts).
* Phone is not connected to USB/power while it syncs.
* Syncing seems to only occur at 60 minutes.

User confirmed via the requestsyncmanager that the request-sync tasks have the correct values for sync interval.

Current suspicion is some behavior in the request-sync logic that will bias to just wake on the longest interval vs trying to compensate for shorter request times.

However, further debugging is needed and given the awkwardness of tracking longer term syncs via adb logcat, I will try to reproduce locally, dig more into it first.
ni? myself so I do not lose track of it after finishing up a checkpoint in conversations work.
Flags: needinfo?(jrburke)
I tried reproducing using three accounts, but did the following:

"Settings > Date & Time" turn off "Set Automatically"

As suggested by bug 1212793 comment 4 to avoid running into bug 1213169. I then modified sync.js to store the sync time as recorded by oncronsyncstart to put that in localStorage so that I could record all the times the sync happened in an hour, and it logged in a way that indicated correct working (the 1,0,2 numbers are the account IDs):

Tue Oct 27 2015 11:44:58 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 11:49:59 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 11:55:01 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:00:02 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:05:03 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:10:05 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:15:06 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:20:08 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:25:09 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:30:11 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:35:12 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:40:09 GMT-0700 (PDT): 2
Tue Oct 27 2015 12:40:14 GMT-0700 (PDT): 1,0
Tue Oct 27 2015 12:45:16 GMT-0700 (PDT): 1,0

There could have been an issue where network was not available for the 5 minute syncs, but when I plugged the phone in after an hour and observed the logcat, at least the last one in that log indicated network was available/the sync successfully worked, and it was the sync on the 5 minute interval.

So I believe the original reporter of this issue was getting hit by a variant of bug 1213169, since depending on when the sync interval was set and the network switching, it could have led to this behavior, with only the 60 minute account surviving. So I am going to dupe to bug 1213169. 

Just in case I need this in the future, the change I did locally to track the syncing in localStorage:

diff --git a/apps/email/js/sync.js b/apps/email/js/sync.js
index d771e3c..8bc1950 100644
--- a/apps/email/js/sync.js
+++ b/apps/email/js/sync.js
@@ -97,7 +97,13 @@ define(function(require) {
     }
 
     api.oncronsyncstart = function(accountIds) {
-      console.log('email oncronsyncstart: ' + accountIds);
+      var nowDate = new Date();
+      console.log(nowDate + ': email oncronsyncstart: ' + accountIds);
+      var logging = localStorage.getItem('SYNCLOG') || '';
+      logging += (logging ? '\n' : '') +
+                  nowDate + ': ' + accountIds;
+      localStorage.setItem('SYNCLOG', logging);
+
       cronSyncStartTime = Date.now();
       var accountKey = makeAccountKey(accountIds);
       waitingOnCron[accountKey] = true;
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(jrburke)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.