Merge pull request #4275 from overleaf/jpa-drop-slow-compile-request-bailout

[misc] drop slow compile request bailout

GitOrigin-RevId: b5eec86878fbc7220dfe163241f29a3f5851c19f
This commit is contained in:
Jakob Ackermann 2021-06-28 17:28:42 +02:00 committed by Copybot
parent 55ca4783fb
commit 103873a013
2 changed files with 1 additions and 36 deletions

View file

@ -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,

View file

@ -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 () {