Skip to content
Snippets Groups Projects
Commit 2ec788cf authored by libnewton's avatar libnewton
Browse files

fix track changes bug

parent f9b1d138
No related branches found
No related tags found
1 merge request!1chore: sync upstream
Pipeline #210632 passed
...@@ -133,41 +133,43 @@ module.exports = HistoryManager = { ...@@ -133,41 +133,43 @@ module.exports = HistoryManager = {
// if the doc_ops_length is undefined it means the project is not using track-changes // if the doc_ops_length is undefined it means the project is not using track-changes
// so we can bail out here // so we can bail out here
if (Settings.disableTrackChanges || typeof docOpsLength === 'undefined') {
logger.debug(
{ projectId, docId },
'skipping flush to track-changes, only using project-history'
)
return callback() return callback()
}
// record updates for track-changes // if (Settings.disableTrackChanges || typeof docOpsLength === 'undefined') {
return HistoryRedisManager.recordDocHasHistoryOps( // logger.debug(
projectId, // { projectId, docId },
docId, // 'skipping flush to track-changes, only using project-history'
ops, // )
function (error) { // return callback()
if (error != null) { // }
return callback(error)
} // // record updates for track-changes
if ( // return HistoryRedisManager.recordDocHasHistoryOps(
HistoryManager.shouldFlushHistoryOps( // projectId,
docOpsLength, // docId,
ops.length, // ops,
HistoryManager.FLUSH_DOC_EVERY_N_OPS // function (error) {
) // if (error != null) {
) { // return callback(error)
// Do this in the background since it uses HTTP and so may be too // }
// slow to wait for when processing a doc update. // if (
logger.debug( // HistoryManager.shouldFlushHistoryOps(
{ docOpsLength, docId, projectId }, // docOpsLength,
'flushing track changes api' // ops.length,
) // HistoryManager.FLUSH_DOC_EVERY_N_OPS
HistoryManager.flushDocChangesAsync(projectId, docId) // )
} // ) {
return callback() // // Do this in the background since it uses HTTP and so may be too
} // // slow to wait for when processing a doc update.
) // logger.debug(
// { docOpsLength, docId, projectId },
// 'flushing track changes api'
// )
// HistoryManager.flushDocChangesAsync(projectId, docId)
// }
// return callback()
// }
// )
}, },
shouldFlushHistoryOps(length, opsLength, threshold) { shouldFlushHistoryOps(length, opsLength, threshold) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment