Prevent timeout when restoring drive
This commit is contained in:
parent
2be78deb93
commit
d816a2ed9f
@ -110,6 +110,8 @@ define([
|
|||||||
value: data
|
value: data
|
||||||
}, function (obj) {
|
}, function (obj) {
|
||||||
cb(obj);
|
cb(obj);
|
||||||
|
}, {
|
||||||
|
timeout: 5 * 60 * 1000
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
common.addSharedFolder = function (secret, cb) {
|
common.addSharedFolder = function (secret, cb) {
|
||||||
@ -1328,12 +1330,12 @@ define([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
postMessage = function (cmd, data, cb) {
|
postMessage = function (cmd, data, cb, opts) {
|
||||||
cb = cb || function () {};
|
cb = cb || function () {};
|
||||||
chan.query(cmd, data, function (err, data) {
|
chan.query(cmd, data, function (err, data) {
|
||||||
if (err) { return void cb ({error: err}); }
|
if (err) { return void cb ({error: err}); }
|
||||||
cb(data);
|
cb(data);
|
||||||
});
|
}, opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Posting CONNECT');
|
console.log('Posting CONNECT');
|
||||||
|
|||||||
@ -32,12 +32,14 @@ define([
|
|||||||
var chan = {};
|
var chan = {};
|
||||||
|
|
||||||
// Send a query. channel.query('Q_SOMETHING', { args: "whatever" }, function (reply) { ... });
|
// Send a query. channel.query('Q_SOMETHING', { args: "whatever" }, function (reply) { ... });
|
||||||
chan.query = function (q, content, cb) {
|
chan.query = function (q, content, cb, opts) {
|
||||||
var txid = mkTxid();
|
var txid = mkTxid();
|
||||||
|
opts = opts || {};
|
||||||
|
var to = opts.timeout || 30000;
|
||||||
var timeout = setTimeout(function () {
|
var timeout = setTimeout(function () {
|
||||||
delete queries[txid];
|
delete queries[txid];
|
||||||
//console.log("Timeout making query " + q);
|
//console.log("Timeout making query " + q);
|
||||||
}, 30000);
|
}, to);
|
||||||
queries[txid] = function (data, msg) {
|
queries[txid] = function (data, msg) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
delete queries[txid];
|
delete queries[txid];
|
||||||
|
|||||||
@ -21,16 +21,18 @@ define([
|
|||||||
var chan = {};
|
var chan = {};
|
||||||
|
|
||||||
// Send a query. channel.query('Q_SOMETHING', { args: "whatever" }, function (reply) { ... });
|
// Send a query. channel.query('Q_SOMETHING', { args: "whatever" }, function (reply) { ... });
|
||||||
chan.query = function (q, content, cb) {
|
chan.query = function (q, content, cb, opts) {
|
||||||
if (!otherWindow) { throw new Error('not yet initialized'); }
|
if (!otherWindow) { throw new Error('not yet initialized'); }
|
||||||
if (!SFrameProtocol[q]) {
|
if (!SFrameProtocol[q]) {
|
||||||
throw new Error('please only make queries are defined in sframe-protocol.js');
|
throw new Error('please only make queries are defined in sframe-protocol.js');
|
||||||
}
|
}
|
||||||
|
opts = opts || {};
|
||||||
var txid = mkTxid();
|
var txid = mkTxid();
|
||||||
|
var to = opts.timeout || 30000;
|
||||||
var timeout = setTimeout(function () {
|
var timeout = setTimeout(function () {
|
||||||
delete queries[txid];
|
delete queries[txid];
|
||||||
console.log("Timeout making query " + q);
|
console.log("Timeout making query " + q);
|
||||||
}, 30000);
|
}, to);
|
||||||
queries[txid] = function (data, msg) {
|
queries[txid] = function (data, msg) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
delete queries[txid];
|
delete queries[txid];
|
||||||
|
|||||||
@ -3374,8 +3374,13 @@ define([
|
|||||||
/* add a history button */
|
/* add a history button */
|
||||||
APP.histConfig = {
|
APP.histConfig = {
|
||||||
onLocal: function () {
|
onLocal: function () {
|
||||||
|
UI.addLoadingScreen({ loadingText: "Please be careful" }); // XXX
|
||||||
proxy.drive = history.currentObj.drive;
|
proxy.drive = history.currentObj.drive;
|
||||||
sframeChan.query("Q_DRIVE_RESTORE", history.currentObj.drive, function () {});
|
sframeChan.query("Q_DRIVE_RESTORE", history.currentObj.drive, function () {
|
||||||
|
UI.removeLoadingScreen();
|
||||||
|
}, {
|
||||||
|
timeout: 5 * 60 * 1000
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onRemote: function () {},
|
onRemote: function () {},
|
||||||
setHistory: setHistory,
|
setHistory: setHistory,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user