Add timeout when downloading a file in drive export
This commit is contained in:
parent
3c99302c32
commit
d748620129
@ -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();
|
||||||
|
|||||||
@ -65,6 +65,32 @@ 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; }
|
||||||
|
|
||||||
|
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 () {
|
setTimeout(function () {
|
||||||
if (ctx.stop) { return; }
|
if (ctx.stop) { return; }
|
||||||
var opts = {
|
var opts = {
|
||||||
@ -73,23 +99,6 @@ define([
|
|||||||
var rawName = fData.filename || fData.title || 'File';
|
var rawName = fData.filename || fData.title || 'File';
|
||||||
console.log(rawName);
|
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,...)
|
// Pads (pad,code,slide,kanban,poll,...)
|
||||||
var todoPad = function () {
|
var todoPad = function () {
|
||||||
ctx.get({
|
ctx.get({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user