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

This commit is contained in:
James Allen 2014-03-01 11:42:31 +00:00
parent d1e18d82aa
commit 76cdd5cf98
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ module.exports = HistoryManager =
HistoryManager.compressAndSaveRawUpdates doc_id, rawUpdates, (error) ->
return callback(error) if error?
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?
if length == HistoryManager.REDIS_READ_BATCH_SIZE
# There might be more updates

View file

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