diff --git a/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee b/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee index 2b38b8f077..eddb1eaddb 100644 --- a/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee +++ b/services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee @@ -63,11 +63,13 @@ describe "DispatchManager", -> @worker.run() - - setTimeout () => - @worker._waitForUpdateThenDispatchWorker.callCount.should.equal 3 - done() - , 100 - - - \ No newline at end of file + + checkStatus = () => + if not @settings.shuttingDown # retry until shutdown + setTimeout checkStatus, 100 + return + else + @worker._waitForUpdateThenDispatchWorker.callCount.should.equal 3 + done() + + checkStatus()