diff --git a/services/web/app/coffee/Features/Compile/CompileManager.coffee b/services/web/app/coffee/Features/Compile/CompileManager.coffee index b7f6ec1610..a0b242e95f 100644 --- a/services/web/app/coffee/Features/Compile/CompileManager.coffee +++ b/services/web/app/coffee/Features/Compile/CompileManager.coffee @@ -31,13 +31,7 @@ module.exports = CompileManager = DocumentUpdaterHandler.flushProjectToMongo project_id, (error) -> return callback(error) if error? ClsiManager.sendRequest project_id, (error, status, outputFiles) -> - if error? - # Sometimes compiles error because the project gets in a broken - # state in the CLSI. So always clear cache on an error. - # Can do this in the background. - ClsiManager.deleteAuxFiles project_id - return callback(error) - + return callback(error) if error? logger.log files: outputFiles, "output files" callback(null, status, outputFiles) diff --git a/services/web/app/views/templates.jade b/services/web/app/views/templates.jade index 3a53acdbbc..9e04573b65 100644 --- a/services/web/app/views/templates.jade +++ b/services/web/app/views/templates.jade @@ -234,9 +234,13 @@ script(type="text/template")#compileErrorTemplate li.alert.alert-error - strong Server Error. - span Sorry, something went wrong and the project could not be compiled. Please try again in a few moments and if the problem continues please contact support. - + p + strong Server Error. + span Sorry, something went wrong and the project could not be compiled. Please try again in a few moments. + p + | If the problem persists, try + a(href='#').js-clear-cache clearing the cache. + | If that doesn't work, please contact support. script(type="text/template")#compileFailedTemplate li.alert.alert-error p diff --git a/services/web/public/coffee/pdf/CompiledView.coffee b/services/web/public/coffee/pdf/CompiledView.coffee index 582934c806..4f12007379 100644 --- a/services/web/public/coffee/pdf/CompiledView.coffee +++ b/services/web/public/coffee/pdf/CompiledView.coffee @@ -117,10 +117,11 @@ define [ errorLogs.prepend($(@templates.compileError)) else if !pdfExists errorLogs.prepend($(@templates.compileFailed)) - errorLogs.find(".js-clear-cache").on "click", () => - @options.manager.deleteCachedFiles() else if pdfExists && compileErrors.all.length == 0 errorLogs.prepend($(@templates.compileSuccess)) + + errorLogs.find(".js-clear-cache").on "click", () => + @options.manager.deleteCachedFiles() @$("#rawLogArea").find("pre").text(rawLog) diff --git a/services/web/test/UnitTests/coffee/Compile/CompileManagerTests.coffee b/services/web/test/UnitTests/coffee/Compile/CompileManagerTests.coffee index 86ca4c4e8c..f1b963a8c5 100644 --- a/services/web/test/UnitTests/coffee/Compile/CompileManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Compile/CompileManagerTests.coffee @@ -75,23 +75,6 @@ describe "CompileManager", -> @logger.log .calledWith(project_id: @project_id, user_id: @user_id, "compiling project") .should.equal true - - describe "when the compile errors", -> - beforeEach -> - @CompileManager._checkIfAutoCompileLimitHasBeenHit = (_, cb)-> cb(null, true) - @ClsiManager.deleteAuxFiles = sinon.stub() - @ClsiManager.sendRequest = sinon.stub().callsArgWith(1, @error = new Error("oops"), @status = "failure") - @CompileManager.compile @project_id, @user_id, {}, @callback - - it "should call the callback with the error", -> - @callback - .calledWith(@error) - .should.equal true - - it "should clear the CLSI cache", -> - @ClsiManager.deleteAuxFiles - .calledWith(@project_id) - .should.equal true describe "when the project has been recently compiled", -> beforeEach ->