Prevent timeout when restoring drive

This commit is contained in:
yflory
2018-07-19 17:51:38 +02:00
parent 2be78deb93
commit d816a2ed9f
4 changed files with 18 additions and 7 deletions

View File

@@ -32,12 +32,14 @@ define([
var chan = {};
// 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();
opts = opts || {};
var to = opts.timeout || 30000;
var timeout = setTimeout(function () {
delete queries[txid];
//console.log("Timeout making query " + q);
}, 30000);
}, to);
queries[txid] = function (data, msg) {
clearTimeout(timeout);
delete queries[txid];