Add timeout when downloading a file in drive export

pull/1/head
yflory 6 years ago
parent 3c99302c32
commit d748620129

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

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

Loading…
Cancel
Save