Explorar el Código

Don't automatically clear the cache

James Allen hace 12 años
padre
commit
8f41c6dcb2

+ 1 - 7
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)
 

+ 7 - 3
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

+ 3 - 2
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)
 			

+ 0 - 17
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 ->