Add timeout when downloading a file in drive export

This commit is contained in:
yflory 2018-10-23 14:22:18 +02:00
parent 3c99302c32
commit d748620129
2 changed files with 27 additions and 18 deletions

View File

@ -1009,7 +1009,7 @@ define([
if (err) { return void cb(err); } if (err) { return void cb(err); }
if (obj.error) { return void cb(obj.error); } if (obj.error) { return void cb(obj.error); }
cb(null, obj.data); cb(null, obj.data);
}, { timeout: 5 * 60 * 1000 }); }, { timeout: 60000 });
}; };
var ui = createExportUI(); var ui = createExportUI();

View File

@ -65,22 +65,19 @@ define([
ctx.sem.take(function (give) { ctx.sem.take(function (give) {
var g = give(); var g = give();
if (ctx.stop) { return; } if (ctx.stop) { return; }
setTimeout(function () {
if (ctx.stop) { return; } var to;
var opts = {
password: fData.password
};
var rawName = fData.filename || fData.title || 'File';
console.log(rawName);
var done = function () { var done = function () {
if (ctx.stop) { return; } if (ctx.stop) { return; }
if (to) { clearTimeout(to); }
//setTimeout(g, 2000); //setTimeout(g, 2000);
g(); g();
w(); w();
ctx.done++; ctx.done++;
ctx.updateProgress('download', {max: ctx.max, current: ctx.done}); ctx.updateProgress('download', {max: ctx.max, current: ctx.done});
}; };
var error = function (err) { var error = function (err) {
if (ctx.stop) { return; } if (ctx.stop) { return; }
done(); done();
@ -90,6 +87,18 @@ define([
}); });
}; };
to = setTimeout(function () {
error('TIMEOUT');
}, 60000);
setTimeout(function () {
if (ctx.stop) { return; }
var opts = {
password: fData.password
};
var rawName = fData.filename || fData.title || 'File';
console.log(rawName);
// Pads (pad,code,slide,kanban,poll,...) // Pads (pad,code,slide,kanban,poll,...)
var todoPad = function () { var todoPad = function () {
ctx.get({ ctx.get({