From a7f44bcd01afcb1ece16da9bd5f72d0f79c30e6c Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 30 Sep 2016 13:36:31 +0100 Subject: [PATCH] Add missing return on callback --- services/track-changes/app/coffee/DiffManager.coffee | 2 +- .../test/unit/coffee/DiffManager/DiffManagerTests.coffee | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/services/track-changes/app/coffee/DiffManager.coffee b/services/track-changes/app/coffee/DiffManager.coffee index 382b366b49..f9adc56ea9 100644 --- a/services/track-changes/app/coffee/DiffManager.coffee +++ b/services/track-changes/app/coffee/DiffManager.coffee @@ -71,7 +71,7 @@ module.exports = DiffManager = if lastUpdate? and lastUpdate.v != version - 1 error = new Error("latest update version, #{lastUpdate.v}, does not match doc version, #{version}") error.retry = true - callback error + return callback error logger.log {docVersion: version, lastUpdateVersion: lastUpdate?.v, updateCount: updates.length}, "rewinding updates" diff --git a/services/track-changes/test/unit/coffee/DiffManager/DiffManagerTests.coffee b/services/track-changes/test/unit/coffee/DiffManager/DiffManagerTests.coffee index d19f3938cf..723193403c 100644 --- a/services/track-changes/test/unit/coffee/DiffManager/DiffManagerTests.coffee +++ b/services/track-changes/test/unit/coffee/DiffManager/DiffManagerTests.coffee @@ -204,9 +204,7 @@ describe "DiffManager", -> @DiffManager._tryGetDocumentBeforeVersion @project_id, @doc_id, @fromVersion, @callback it "should call the callback with an error with retry = true set", -> - @callback - .calledWith(new Error("latest update version, 40, does not match doc version, 42")) - .should.equal true + @callback.calledOnce.should.equal true error = @callback.args[0][0] expect(error.retry).to.equal true