From ebbe728ec1ba7410901fdfd91a714c9af577e1a6 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 9 Oct 2019 11:11:15 +0100 Subject: [PATCH] fix performance of update removal --- services/track-changes/app/coffee/RedisManager.coffee | 2 +- .../test/unit/coffee/RedisManager/RedisManagerTests.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/track-changes/app/coffee/RedisManager.coffee b/services/track-changes/app/coffee/RedisManager.coffee index 56dcfd4372..b23a308fc5 100644 --- a/services/track-changes/app/coffee/RedisManager.coffee +++ b/services/track-changes/app/coffee/RedisManager.coffee @@ -21,7 +21,7 @@ module.exports = RedisManager = multi = rclient.multi() # Delete all the updates which have been applied (exact match) for update in docUpdates or [] - multi.lrem Keys.uncompressedHistoryOps({doc_id}), 0, update + multi.lrem Keys.uncompressedHistoryOps({doc_id}), 1, update multi.exec (error, results) -> return callback(error) if error? # It's ok to delete the doc_id from the set here. Even though the list diff --git a/services/track-changes/test/unit/coffee/RedisManager/RedisManagerTests.coffee b/services/track-changes/test/unit/coffee/RedisManager/RedisManagerTests.coffee index be20b38d21..b7009f5d74 100644 --- a/services/track-changes/test/unit/coffee/RedisManager/RedisManagerTests.coffee +++ b/services/track-changes/test/unit/coffee/RedisManager/RedisManagerTests.coffee @@ -56,12 +56,12 @@ describe "RedisManager", -> it "should delete the first update from redis", -> @rclient.lrem - .calledWith("UncompressedHistoryOps:#{@doc_id}", 0, @jsonUpdates[0]) + .calledWith("UncompressedHistoryOps:#{@doc_id}", 1, @jsonUpdates[0]) .should.equal true it "should delete the second update from redis", -> @rclient.lrem - .calledWith("UncompressedHistoryOps:#{@doc_id}", 0, @jsonUpdates[1]) + .calledWith("UncompressedHistoryOps:#{@doc_id}", 1, @jsonUpdates[1]) .should.equal true it "should delete the doc from the set of docs with history ops", ->