Преглед изворни кода

set the request timeout to a few mins for the compile

Henry Oswald пре 12 година
родитељ
комит
b9d6d5bbf1

+ 1 - 0
services/web/app/coffee/Features/Compile/CompileController.coffee

@@ -10,6 +10,7 @@ UserGetter = require "../User/UserGetter"
 
 
 module.exports = CompileController =
 module.exports = CompileController =
 	compile: (req, res, next = (error) ->) ->
 	compile: (req, res, next = (error) ->) ->
+		res.setTimeout(5 * 60 * 1000)
 		project_id = req.params.Project_id
 		project_id = req.params.Project_id
 		isAutoCompile = !!req.query?.auto_compile
 		isAutoCompile = !!req.query?.auto_compile
 		settingsOverride = req.body?.settingsOverride ? {};
 		settingsOverride = req.body?.settingsOverride ? {};

+ 7 - 0
services/web/test/UnitTests/coffee/Compile/CompileControllerTests.coffee

@@ -38,6 +38,11 @@ describe "CompileController", ->
 		@res = new MockResponse()
 		@res = new MockResponse()
 
 
 	describe "compile", ->
 	describe "compile", ->
+
+
+
+
+
 		describe "when not an auto compile", ->
 		describe "when not an auto compile", ->
 			beforeEach ->
 			beforeEach ->
 				@req.params =
 				@req.params =
@@ -73,6 +78,8 @@ describe "CompileController", ->
 				@UserGetter.getUser.args[0][0].should.equal @user_id
 				@UserGetter.getUser.args[0][0].should.equal @user_id
 				assert.deepEqual @UserGetter.getUser.args[0][1], {"features.compileGroup":1, "features.compileTimeout":1}
 				assert.deepEqual @UserGetter.getUser.args[0][1], {"features.compileGroup":1, "features.compileTimeout":1}
 
 
+			it "should set the timeout", ->
+				assert @res.timout > 1000 * 60 * 3
 
 
 		describe "when an auto compile", ->
 		describe "when an auto compile", ->
 			beforeEach ->
 			beforeEach ->

+ 2 - 0
services/web/test/UnitTests/coffee/helpers/MockResponse.coffee

@@ -39,6 +39,8 @@ class MockResponse
 	setHeader: (header, value) ->
 	setHeader: (header, value) ->
 		@headers[header] = value
 		@headers[header] = value
 
 
+	setTimeout: (@timout)->
+
 	header: sinon.stub()
 	header: sinon.stub()
 
 
 	contentType: sinon.stub()
 	contentType: sinon.stub()