diff --git a/services/web/app/src/Features/Compile/ClsiManager.js b/services/web/app/src/Features/Compile/ClsiManager.js index a5a42d4cf1..b90efaac55 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.js +++ b/services/web/app/src/Features/Compile/ClsiManager.js @@ -472,6 +472,9 @@ const ClsiManager = { } 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 e10fb25071..2e232e8a3d 100644 --- a/services/web/test/unit/src/Compile/ClsiManagerTests.js +++ b/services/web/test/unit/src/Compile/ClsiManagerTests.js @@ -974,6 +974,27 @@ 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 () {