store indicator file near Editor.bin to determine if opening was from the forgotten file

This commit is contained in:
konovalovsergey
2017-09-08 12:46:38 +03:00
parent 412ae51ebb
commit aa53c6f4e4
2 changed files with 12 additions and 1 deletions

View File

@ -589,7 +589,14 @@ function* commandSfcCallback(cmd, isSfcm) {
try {
let forgottenId = cfgForgottenFiles + '/' + docId;
let forgotten = yield storage.listObjects(forgottenId);
if (0 === forgotten.length) {
let isSendHistory = 0 === forgotten.length;
if (!isSendHistory) {
//check indicator file to determine if opening was from the forgotten file
var forgottenMarkPath = docId + '/' + cfgForgottenFilesName + '.txt';
var forgottenMark = yield storage.listObjects(forgottenMarkPath);
isSendHistory = 0 === forgottenMark.length;
}
if (isSendHistory) {
//don't send history info because changes isn't from file in storage
var data = yield storage.getObject(savePathHistory);
outputSfc.setChangeHistory(JSON.parse(data.toString('utf-8')));

View File

@ -59,6 +59,7 @@ var cfgFilePath = configConverter.get('filePath');
var cfgArgs = configConverter.get('args');
var cfgErrorFiles = configConverter.get('errorfiles');
var cfgTokenEnableRequestOutbox = config.get('services.CoAuthoring.token.enable.request.outbox');
const cfgForgottenFilesName = config.get('services.CoAuthoring.server.forgottenfilesname');
//windows limit 512(2048) https://msdn.microsoft.com/en-us/library/6e3b887c.aspx
//Ubuntu 14.04 limit 4096 http://underyx.me/2015/05/18/raising-the-maximum-number-of-file-descriptors.html
@ -523,6 +524,9 @@ function* ExecuteTask(task) {
let list = yield utils.listObjects(tempDirs.source, false);
if (list.length > 0) {
dataConvert.fileFrom = list[0];
//store indicator file to determine if opening was from the forgotten file
var forgottenMarkPath = tempDirs.result + '/' + cfgForgottenFilesName + '.txt';
fs.writeFileSync(forgottenMarkPath, cfgForgottenFilesName, {encoding: 'utf8'});
} else {
error = constants.UNKNOWN;
}