mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4261 from overleaf/jpa-fake-timed-out-response
[ClsiManager] respond w/ status=timedout for timed out compile requests GitOrigin-RevId: 2937355bfd8d58870509ab40c2ba19f014f82a37
This commit is contained in:
parent
d6f9f70d06
commit
e57be19ee3
2 changed files with 24 additions and 0 deletions
|
@ -472,6 +472,9 @@ const ClsiManager = {
|
||||||
}
|
}
|
||||||
ClsiManager._makeRequest(projectId, opts, (err, response, body) => {
|
ClsiManager._makeRequest(projectId, opts, (err, response, body) => {
|
||||||
if (err != null) {
|
if (err != null) {
|
||||||
|
if (err.code === 'ESOCKETTIMEDOUT') {
|
||||||
|
return callback(null, { compile: { status: 'timedout' } })
|
||||||
|
}
|
||||||
return callback(
|
return callback(
|
||||||
new OError('failed to make request to CLSI', {
|
new OError('failed to make request to CLSI', {
|
||||||
projectId,
|
projectId,
|
||||||
|
|
|
@ -974,6 +974,27 @@ describe('ClsiManager', function () {
|
||||||
this.callback.should.have.been.calledWith(sinon.match.instanceOf(Error))
|
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 () {
|
describe('wordCount', function () {
|
||||||
|
|
Loading…
Reference in a new issue