Handle if two updates cancel each other

This commit is contained in:
James Allen 2013-08-09 12:36:17 +01:00
parent 54c7959647
commit 3ab45c2a35

View file

@ -40,7 +40,10 @@ module.exports = ConversionManager =
compressedUpdates = [lastCompressedUpdate]
for rawUpdate in rawUpdates
lastCompressedUpdate = compressedUpdates.pop()
compressedUpdates = compressedUpdates.concat ConcatManager.concatTwoUpdates lastCompressedUpdate, rawUpdate
if lastCompressedUpdate?
compressedUpdates = compressedUpdates.concat ConcatManager.concatTwoUpdates lastCompressedUpdate, rawUpdate
else
compressedUpdates.push rawUpdate
ConversionManager.removeLatestCompressedUpdate doc_id, (error) ->
return callback(error) if error?
callback null, compressedUpdates