Skip to content

Commit

Permalink
[bug] Fix bug with opening error after forcesave on forgotten file
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Mar 25, 2024
1 parent 1050bb7 commit f02884b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
13 changes: 6 additions & 7 deletions DocService/sources/DocsCoServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,13 +962,6 @@ async function startForceSave(ctx, docId, type, opt_userdata, opt_formdata, opt_
forceSave.setAuthorUserId(opt_userId);
forceSave.setAuthorUserIndex(opt_userIndex);

if (commonDefines.c_oAscForceSaveTypes.Timeout === type) {
await co(publish(ctx, {
type: commonDefines.c_oPublishType.forceSave, ctx: ctx, docId: docId,
data: {type: type, time: forceSave.getTime(), start: true}
}, undefined, undefined, opt_pubsub));
}

let priority;
let expiration;
if (commonDefines.c_oAscForceSaveTypes.Timeout === type) {
Expand All @@ -983,6 +976,12 @@ async function startForceSave(ctx, docId, type, opt_userdata, opt_formdata, opt_
opt_queue, undefined, opt_initShardKey);
if (constants.NO_ERROR === status.err) {
res.time = forceSave.getTime();
if (commonDefines.c_oAscForceSaveTypes.Timeout === type) {
await co(publish(ctx, {
type: commonDefines.c_oPublishType.forceSave, ctx: ctx, docId: docId,
data: {type: type, time: forceSave.getTime(), start: true}
}, undefined, undefined, opt_pubsub));
}
} else {
res.code = commonDefines.c_oAscServerCommandErrors.UnknownError;
}
Expand Down
5 changes: 4 additions & 1 deletion DocService/sources/canvasservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ let commandSfctByCmd = co.wrap(function*(ctx, cmd, opt_priority, opt_expiration,
var selectRes = yield taskResult.select(ctx, cmd.getDocId());
var row = selectRes.length > 0 ? selectRes[0] : null;
if (!row) {
return;
return false;
}
if (opt_initShardKey) {
ctx.setShardKey(sqlBase.DocumentAdditional.prototype.getShardKey(row.additional));
Expand All @@ -632,6 +632,7 @@ let commandSfctByCmd = co.wrap(function*(ctx, cmd, opt_priority, opt_expiration,
queueData.setFromChanges(true);
let priority = null != opt_priority ? opt_priority : constants.QUEUE_PRIORITY_LOW;
yield* docsCoServer.addTask(queueData, priority, opt_queue, opt_expiration);
return true;
});
function isDisplayedImage(strName) {
var res = 0;
Expand Down Expand Up @@ -1167,6 +1168,8 @@ const commandSfcCallback = co.wrap(function*(ctx, cmd, isSfcm, isEncrypted) {
}
if (!isSfcm) {
//todo simultaneous opening
//clean redis (redisKeyPresenceSet and redisKeyPresenceHash removed with last element)
yield docsCoServer.editorData.cleanDocumentOnExit(ctx, docId);
//to unlock wopi file
yield docsCoServer.unlockWopiDoc(ctx, docId, callbackUserIndex);
//cleanupRes can be false in case of simultaneous opening. it is OK
Expand Down
5 changes: 4 additions & 1 deletion DocService/sources/converterservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ async function convertFromChanges(ctx, docId, baseUrl, forceSave, externalChange
cmd.setRedisKey(opt_redisKey);
}

await canvasService.commandSfctByCmd(ctx, cmd, opt_priority, opt_expiration, opt_queue, opt_initShardKey);
let commandSfctByCmdRes = await canvasService.commandSfctByCmd(ctx, cmd, opt_priority, opt_expiration, opt_queue, opt_initShardKey);
if (!commandSfctByCmdRes) {
return new commonDefines.ConvertStatus(constants.UNKNOWN);
}
var fileTo = constants.OUTPUT_NAME;
let outputExt = formatChecker.getStringFromFormat(cmd.getOutputFormat());
if (outputExt) {
Expand Down

0 comments on commit f02884b

Please sign in to comment.