mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Only auto clear CLSI cache on hard error, otherwise prompt user
This commit is contained in:
parent
ce0fb75224
commit
063f6c7680
4 changed files with 17 additions and 12 deletions
|
@ -31,15 +31,14 @@ module.exports = CompileManager =
|
||||||
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
|
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
ClsiManager.sendRequest project_id, (error, status, outputFiles) ->
|
ClsiManager.sendRequest project_id, (error, status, outputFiles) ->
|
||||||
return callback(error) if error?
|
if error?
|
||||||
logger.log files: outputFiles, "output files"
|
# Sometimes compiles error because the project gets in a broken
|
||||||
|
# state in the CLSI. So always clear cache on an error.
|
||||||
if status == "failure"
|
|
||||||
# Sometimes compiles fail because the project gets in a broken
|
|
||||||
# state in LaTeX. So always clear cache on a failure.
|
|
||||||
# Can do this in the background.
|
# Can do this in the background.
|
||||||
ClsiManager.deleteAuxFiles project_id
|
ClsiManager.deleteAuxFiles project_id
|
||||||
|
return callback(error)
|
||||||
|
|
||||||
|
logger.log files: outputFiles, "output files"
|
||||||
callback(null, status, outputFiles)
|
callback(null, status, outputFiles)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,12 @@
|
||||||
|
|
||||||
script(type="text/template")#compileFailedTemplate
|
script(type="text/template")#compileFailedTemplate
|
||||||
li.alert.alert-error
|
li.alert.alert-error
|
||||||
strong Ooops, your LaTeX code couldn't compile for some reason. Please check the errors below for details, or view the raw log.
|
p
|
||||||
|
strong Compile Error.
|
||||||
|
span Sorry, your LaTeX code couldn't compile for some reason. Please check the errors below for details, or view the raw log.
|
||||||
|
p
|
||||||
|
| If the problem persists, try
|
||||||
|
a(href='#').js-clear-cache clearing the cache.
|
||||||
script(type="text/template")#compileTimeoutTemplate
|
script(type="text/template")#compileTimeoutTemplate
|
||||||
li.alert.alert-error
|
li.alert.alert-error
|
||||||
strong Timed out.
|
strong Timed out.
|
||||||
|
|
|
@ -117,6 +117,8 @@ define [
|
||||||
errorLogs.prepend($(@templates.compileError))
|
errorLogs.prepend($(@templates.compileError))
|
||||||
else if !pdfExists
|
else if !pdfExists
|
||||||
errorLogs.prepend($(@templates.compileFailed))
|
errorLogs.prepend($(@templates.compileFailed))
|
||||||
|
errorLogs.find(".js-clear-cache").on "click", () =>
|
||||||
|
@options.manager.deleteCachedFiles()
|
||||||
else if pdfExists && compileErrors.all.length == 0
|
else if pdfExists && compileErrors.all.length == 0
|
||||||
errorLogs.prepend($(@templates.compileSuccess))
|
errorLogs.prepend($(@templates.compileSuccess))
|
||||||
|
|
||||||
|
|
|
@ -76,16 +76,16 @@ describe "CompileManager", ->
|
||||||
.calledWith(project_id: @project_id, user_id: @user_id, "compiling project")
|
.calledWith(project_id: @project_id, user_id: @user_id, "compiling project")
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
describe "when the compile fails", ->
|
describe "when the compile errors", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@CompileManager._checkIfAutoCompileLimitHasBeenHit = (_, cb)-> cb(null, true)
|
@CompileManager._checkIfAutoCompileLimitHasBeenHit = (_, cb)-> cb(null, true)
|
||||||
@ClsiManager.deleteAuxFiles = sinon.stub()
|
@ClsiManager.deleteAuxFiles = sinon.stub()
|
||||||
@ClsiManager.sendRequest = sinon.stub().callsArgWith(1, null, @status = "failure")
|
@ClsiManager.sendRequest = sinon.stub().callsArgWith(1, @error = new Error("oops"), @status = "failure")
|
||||||
@CompileManager.compile @project_id, @user_id, {}, @callback
|
@CompileManager.compile @project_id, @user_id, {}, @callback
|
||||||
|
|
||||||
it "should call the callback", ->
|
it "should call the callback with the error", ->
|
||||||
@callback
|
@callback
|
||||||
.calledWith(null, @status)
|
.calledWith(@error)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should clear the CLSI cache", ->
|
it "should clear the CLSI cache", ->
|
||||||
|
|
Loading…
Reference in a new issue