bug 518273 - need to handle not having an active node assigned, r=edilee

--HG--
extra : rebase_source : f86c6cc164241cee263345de5e13dd5ae0a3758b
This commit is contained in:
Mike Connor 2009-09-29 18:33:41 -07:00
Родитель 1468737a00
Коммит 061821547d
3 изменённых файлов: 21 добавлений и 2 удалений

Просмотреть файл

@ -21,5 +21,7 @@ error.logout.title = Error While Signing Out
error.logout.description = Weave encountered an error while signing you out. It's probably ok, and you don't have to do anything about it.
error.sync.title = Error While Syncing
error.sync.description = Weave encountered an error while syncing: %1$S. Weave will automatically retry this action.
error.sync.no_node_found = The Weave server is a little busy right now, but you don't need to do anything about it. We'll start syncing your data as soon as we can!
error.sync.no_node_found.title = Sync Delay
error.sync.tryAgainButton.label = Sync Now
error.sync.tryAgainButton.accesskey = S

Просмотреть файл

@ -101,6 +101,7 @@ NO_KEYS_NO_KEYGEN: "error.sync.reason.no_keys_no_keygen",
KEYS_UPLOAD_FAIL: "error.sync.reason.keys_upload_fail",
SETUP_FAILED_NO_PASSPHRASE: "error.sync.reason.setup_failed_no_passphrase",
ABORT_SYNC_COMMAND: "aborting sync, process commands said so",
NO_SYNC_NODE_FOUND: "error.sync.reason.no_node_found",
// engine failure status codes
ENGINE_UPLOAD_FAIL: "error.engine.reason.record_upload_fail",

Просмотреть файл

@ -489,6 +489,8 @@ WeaveSvc.prototype = {
return this.serverURL;
case 0:
case 200:
if (node == "null")
node = null;
return node;
default:
this._log.debug("Unexpected response code: " + node.status);
@ -505,6 +507,7 @@ WeaveSvc.prototype = {
_setCluster: function _setCluster() {
// Make sure we didn't get some unexpected response for the cluster
let cluster = this._findCluster();
this._log.debug("cluster value = " + cluster);
if (cluster == null)
return false;
@ -532,8 +535,13 @@ WeaveSvc.prototype = {
_verifyLogin: function _verifyLogin()
this._notify("verify-login", "", function() {
// Make sure we have a cluster to verify against
if (this.clusterURL == "")
this._setCluster();
// this is a little weird, if we don't get a node we pretend
// to succeed, since that probably means we just don't have storage
if (this.clusterURL == "" && !this._setCluster()) {
this.status.setSyncStatus(NO_SYNC_NODE_FOUND);
Svc.Observer.notifyObservers(null, "weave:service:sync:delayed", "");
return true;
}
try {
let test = new Resource(this.infoURL).get();
@ -1074,6 +1082,14 @@ WeaveSvc.prototype = {
sync: function sync()
this._catch(this._lock(this._notify("sync", "", function() {
this.status.resetEngineStatus();
// if we don't have a node, get one. if that fails, retry in 10 minutes
if (this.clusterURL == "" && !this._setCluster()) {
this._scheduleNextSync(10 * 60 * 1000);
return;
}
fullSync = true; // not doing thresholds yet
// Make sure we should sync or record why we shouldn't
let reason = this._checkSync();