Ver código fonte

Delete only the updates that were processed, not a full batch

James Allen 12 anos atrás
pai
commit
76cdd5cf98

+ 1 - 1
services/track-changes/app/coffee/HistoryManager.coffee

@@ -39,7 +39,7 @@ module.exports = HistoryManager =
 			HistoryManager.compressAndSaveRawUpdates doc_id, rawUpdates, (error) ->
 			HistoryManager.compressAndSaveRawUpdates doc_id, rawUpdates, (error) ->
 				return callback(error) if error?
 				return callback(error) if error?
 				logger.log doc_id: doc_id, "compressed and saved doc updates"
 				logger.log doc_id: doc_id, "compressed and saved doc updates"
-				RedisManager.deleteOldestRawUpdates doc_id, HistoryManager.REDIS_READ_BATCH_SIZE, (error) ->
+				RedisManager.deleteOldestRawUpdates doc_id, length, (error) ->
 					return callback(error) if error?
 					return callback(error) if error?
 					if length == HistoryManager.REDIS_READ_BATCH_SIZE
 					if length == HistoryManager.REDIS_READ_BATCH_SIZE
 						# There might be more updates
 						# There might be more updates

+ 1 - 1
services/track-changes/test/unit/coffee/HistoryManager/HistoryManagerTests.coffee

@@ -132,7 +132,7 @@ describe "HistoryManager", ->
 
 
 			it "should delete the batch of uncompressed updates that was just processed", ->
 			it "should delete the batch of uncompressed updates that was just processed", ->
 				@RedisManager.deleteOldestRawUpdates
 				@RedisManager.deleteOldestRawUpdates
-					.calledWith(@doc_id, @HistoryManager.REDIS_READ_BATCH_SIZE)
+					.calledWith(@doc_id, @updates.length)
 					.should.equal true
 					.should.equal true
 
 
 			it "should call the callback", ->
 			it "should call the callback", ->