From b9d6d5bbf1af2de962ac073a3f5c6ecb02228d26 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Oct 2014 13:23:29 +0100 Subject: [PATCH] set the request timeout to a few mins for the compile --- .../app/coffee/Features/Compile/CompileController.coffee | 1 + .../UnitTests/coffee/Compile/CompileControllerTests.coffee | 7 +++++++ .../web/test/UnitTests/coffee/helpers/MockResponse.coffee | 2 ++ 3 files changed, 10 insertions(+) diff --git a/services/web/app/coffee/Features/Compile/CompileController.coffee b/services/web/app/coffee/Features/Compile/CompileController.coffee index 68c8479f04..ec6ccd677b 100755 --- a/services/web/app/coffee/Features/Compile/CompileController.coffee +++ b/services/web/app/coffee/Features/Compile/CompileController.coffee @@ -10,6 +10,7 @@ UserGetter = require "../User/UserGetter" module.exports = CompileController = compile: (req, res, next = (error) ->) -> + res.setTimeout(5 * 60 * 1000) project_id = req.params.Project_id isAutoCompile = !!req.query?.auto_compile settingsOverride = req.body?.settingsOverride ? {}; diff --git a/services/web/test/UnitTests/coffee/Compile/CompileControllerTests.coffee b/services/web/test/UnitTests/coffee/Compile/CompileControllerTests.coffee index 020d084c71..5cdf58f193 100644 --- a/services/web/test/UnitTests/coffee/Compile/CompileControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Compile/CompileControllerTests.coffee @@ -38,6 +38,11 @@ describe "CompileController", -> @res = new MockResponse() describe "compile", -> + + + + + describe "when not an auto compile", -> beforeEach -> @req.params = @@ -73,6 +78,8 @@ describe "CompileController", -> @UserGetter.getUser.args[0][0].should.equal @user_id 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", -> beforeEach -> diff --git a/services/web/test/UnitTests/coffee/helpers/MockResponse.coffee b/services/web/test/UnitTests/coffee/helpers/MockResponse.coffee index 080d4ec758..ab78f248b9 100644 --- a/services/web/test/UnitTests/coffee/helpers/MockResponse.coffee +++ b/services/web/test/UnitTests/coffee/helpers/MockResponse.coffee @@ -39,6 +39,8 @@ class MockResponse setHeader: (header, value) -> @headers[header] = value + setTimeout: (@timout)-> + header: sinon.stub() contentType: sinon.stub()