From 103873a013b09768ac6ff10da798dd7415d8d3f0 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 28 Jun 2021 17:28:42 +0200 Subject: [PATCH] Merge pull request #4275 from overleaf/jpa-drop-slow-compile-request-bailout [misc] drop slow compile request bailout GitOrigin-RevId: b5eec86878fbc7220dfe163241f29a3f5851c19f --- .../app/src/Features/Compile/ClsiManager.js | 13 ---------- .../test/unit/src/Compile/ClsiManagerTests.js | 24 +------------------ 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/services/web/app/src/Features/Compile/ClsiManager.js b/services/web/app/src/Features/Compile/ClsiManager.js index de105cdb36..2e96a8b3ae 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.js +++ b/services/web/app/src/Features/Compile/ClsiManager.js @@ -23,9 +23,6 @@ const Metrics = require('@overleaf/metrics') const Errors = require('../Errors/Errors') const VALID_COMPILERS = ['pdflatex', 'latex', 'xelatex', 'lualatex'] -// see clsi: RequestParser.MAX_TIMEOUT -const DEFAULT_TIMEOUT = 600 -const OVERHEAD_SYNC_AND_OUTPUT = 120 * 1000 const ClsiManager = { sendRequest(projectId, userId, options, callback) { @@ -458,23 +455,13 @@ const ClsiManager = { userId, 'compile' ) - const timeout = - OVERHEAD_SYNC_AND_OUTPUT + - ((req.compile && req.compile.options && req.compile.options.timeout) || - DEFAULT_TIMEOUT) * - 1000 - const opts = { url: compileUrl, json: req, method: 'POST', - timeout, } ClsiManager._makeRequest(projectId, opts, (err, response, body) => { if (err != null) { - if (err.code === 'ESOCKETTIMEDOUT') { - return callback(null, { compile: { status: 'timedout' } }) - } return callback( new OError('failed to make request to CLSI', { projectId, diff --git a/services/web/test/unit/src/Compile/ClsiManagerTests.js b/services/web/test/unit/src/Compile/ClsiManagerTests.js index dcd5edb195..4b41bfe8e9 100644 --- a/services/web/test/unit/src/Compile/ClsiManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiManagerTests.js @@ -912,7 +912,7 @@ describe('ClsiManager', function () { describe('_postToClsi', function () { beforeEach(function () { - this.req = { compile: { options: { timeout: 42 } } } + this.req = { mock: 'req', compile: {} } }) describe('successfully', function () { @@ -941,7 +941,6 @@ describe('ClsiManager', function () { method: 'POST', url, json: this.req, - timeout: 42 * 1000 + 120 * 1000, }) .should.equal(true) }) @@ -974,27 +973,6 @@ describe('ClsiManager', function () { this.callback.should.have.been.calledWith(sinon.match.instanceOf(Error)) }) }) - - describe('when the CLSI request times out', function () { - beforeEach(function () { - this.ClsiManager._makeRequest = sinon - .stub() - .callsArgWith(2, { code: 'ESOCKETTIMEDOUT' }, null, null) - this.ClsiManager._postToClsi( - this.project_id, - this.user_id, - this.req, - 'standard', - this.callback - ) - }) - - it('should call the callback with a timed out response', function () { - this.callback.should.have.been.calledWith(null, { - compile: { status: 'timedout' }, - }) - }) - }) }) describe('wordCount', function () {