mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[bug] Set timeout for entire conversion(wait results uploading); Remove result dir to reduce amount of data transferred in case of error
This commit is contained in:
@ -40,6 +40,7 @@ var config = require('config');
|
||||
var spawnAsync = require('@expo/spawn-async');
|
||||
const bytes = require('bytes');
|
||||
const lcid = require('lcid');
|
||||
const ms = require('ms');
|
||||
|
||||
var commonDefines = require('./../../Common/sources/commondefines');
|
||||
var storage = require('./../../Common/sources/storage-base');
|
||||
@ -787,6 +788,10 @@ function* processUploadToStorageErrorFile(ctx, dataConvert, tempDirs, childRes,
|
||||
let outputPath = path.join(tempDirs.temp, 'console.txt');
|
||||
fs.writeFileSync(outputPath, output, {encoding: 'utf8'});
|
||||
|
||||
//remove result dir with temp dir inside(see m_sTempDir param) to reduce the amount of data transferred
|
||||
//todo filter on upload
|
||||
fs.rmSync(tempDirs.result, { recursive: true, force: true });
|
||||
|
||||
let format = path.extname(dataConvert.fileFrom).substring(1) || "unknown";
|
||||
|
||||
yield* processUploadToStorage(ctx, tempDirs.temp, format + '/' + dataConvert.key , false, tenErrorFiles);
|
||||
@ -919,7 +924,7 @@ function* spawnProcess(ctx, builderParams, tempDirs, dataConvert, authorProps, g
|
||||
}
|
||||
let spawnAsyncPromise = spawnAsync(processPath, childArgs, spawnOptions);
|
||||
childRes = spawnAsyncPromise.child;
|
||||
let waitMS = task.getVisibilityTimeout() * 1000 - (new Date().getTime() - getTaskTime.getTime());
|
||||
let waitMS = Math.max(0, task.getVisibilityTimeout() * 1000 - (new Date().getTime() - getTaskTime.getTime()));
|
||||
timeoutId = setTimeout(function() {
|
||||
isTimeout = true;
|
||||
timeoutId = undefined;
|
||||
@ -1099,7 +1104,8 @@ function ackTask(ctx, res, task, ack) {
|
||||
});
|
||||
}
|
||||
function receiveTaskSetTimeout(ctx, task, ack, outParams) {
|
||||
let delay = 1.1 * task.getVisibilityTimeout() * 1000;
|
||||
//add DownloadTimeout to upload results
|
||||
let delay = task.getVisibilityTimeout() * 1000 + ms(cfgDownloadTimeout.wholeCycle);
|
||||
return setTimeout(function() {
|
||||
return co(function*() {
|
||||
outParams.isAck = true;
|
||||
|
||||
Reference in New Issue
Block a user