Don't automatically clear the cache

This commit is contained in:
James Allen 2014-05-21 15:20:14 +01:00
parent 10c012d856
commit 8f41c6dcb2
4 changed files with 11 additions and 29 deletions

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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 ->