diff --git a/src/js/background.js b/src/js/background.js
index f6e69af..6ce195c 100644
--- a/src/js/background.js
+++ b/src/js/background.js
@@ -419,12 +419,16 @@ function main() {
if (!syncMs) {
nextExpectedSync = null;
}
+ // This can mutate backoffStart, so it needs to be explicitly run before accessing it.
+ const inBackoff = manager.inBackoff();
sendResponse({
lastPSync,
nextExpectedSync,
lastSyncInfo,
'randomCacheTS': Track.randomCacheTS,
- inBackoff: manager.inBackoff(),
+ inBackoff,
+ backoffStartMs: manager.backoffStart ? manager.backoffStart.valueOf() : null,
+ backoffMins: Syncing.BACKOFF_MINS,
});
});
});
diff --git a/src/js/syncing.js b/src/js/syncing.js
index e222687..8daba3c 100644
--- a/src/js/syncing.js
+++ b/src/js/syncing.js
@@ -20,7 +20,7 @@ const Reporting = require('./reporting');
// This is being used to hold the old global state moving out of background.
const globalState = {};
-const BACKOFF_MINS = 15;
+const BACKOFF_MINS = 30;
class Manager {
// A sync manager serializes access to both remote and local (cached) Music resources.
@@ -185,6 +185,7 @@ class Manager {
}
exports.Manager = Manager;
+exports.BACKOFF_MINS = BACKOFF_MINS;
function sync(details, batchingEnabled) {
// Promise a list of api responses.
diff --git a/src/js/syncpage.js b/src/js/syncpage.js
index f49d845..19295ce 100644
--- a/src/js/syncpage.js
+++ b/src/js/syncpage.js
@@ -6,6 +6,7 @@ const moment = require('moment');
const Reporting = require('./reporting');
const SUPPORT_LINK = 'https://github.com/simon-weber/Autoplaylists-for-Google-Music/wiki';
+const SYNCING_GUIDE_LINK = 'https://github.com/simon-weber/Autoplaylists-for-Google-Music/wiki/Debugging#handling-syncing-failures-or-an-overloaded-account';
/* eslint-disable */
// https://gist.github.com/kerimdzhanov/f6f0d2b2a57720426211
@@ -43,13 +44,15 @@ function onReady() {
let nextSyncInfo = 'Periodic syncing is disabled.';
if (status.inBackoff) {
- nextSyncInfo = 'Periodic syncing has been temporarily disabled since your account is showing signs of being overloaded.'
- + ' Syncing will resume in 30 minutes.';
+ const backoffEndsIn = moment(new Date(status.backoffStartMs + (status.backoffMins * 60 * 1000))).fromNow();
+ nextSyncInfo = 'Periodic syncing is temporarily disabled since Google'
+ + ` is showing signs of being overloaded.`
+ + `
Syncing will be enabled again ${backoffEndsIn}.`;
$('#sync-now').attr('disabled', true);
} else if (status.nextExpectedSync) {
nextSyncInfo = `The next full sync is expected ${moment(new Date(status.nextExpectedSync)).fromNow()}.`;
}
- $('#next-sync-info').text(nextSyncInfo);
+ $('#next-sync-info').html(nextSyncInfo);
});
$('#sync-now').click(e => {