Merge pull request #7961 from overleaf/jpa-shorter-clsi-persistence

[web] lower clsi persistence duration

GitOrigin-RevId: 72929de084c5c5aac5f2382ad91a7665e96742a8
This commit is contained in:
Alf Eaton
2022-05-16 10:43:25 +01:00
committed by Copybot
parent 0eb99b2eff
commit d68180bc4e
2 changed files with 33 additions and 5 deletions
@@ -45,7 +45,8 @@ describe('ClsiCookieManager', function () {
},
},
clsiCookie: {
ttl: Math.random(),
ttlInSeconds: Math.random().toString(),
ttlInSecondsRegular: Math.random().toString(),
key: 'coooookie',
},
}
@@ -172,7 +173,7 @@ describe('ClsiCookieManager', function () {
this.redis.setex
.calledWith(
`clsiserver:${this.project_id}:${this.user_id}`,
this.settings.clsiCookie.ttl,
this.settings.clsiCookie.ttlInSeconds,
'clsi-8'
)
.should.equal(true)
@@ -181,6 +182,27 @@ describe('ClsiCookieManager', function () {
)
})
it('should set the server id with the regular ttl for reg instance', function (done) {
this.ClsiCookieManager._parseServerIdFromResponse = sinon
.stub()
.returns('clsi-reg-8')
this.ClsiCookieManager.setServerId(
this.project_id,
this.user_id,
'standard',
this.response,
null,
err => {
expect(this.redis.setex).to.have.been.calledWith(
`clsiserver:${this.project_id}:${this.user_id}`,
this.settings.clsiCookie.ttlInSecondsRegular,
'clsi-reg-8'
)
done()
}
)
})
it('should return the server id', function (done) {
return this.ClsiCookieManager.setServerId(
this.project_id,
@@ -260,7 +282,7 @@ describe('ClsiCookieManager', function () {
this.redis_secondary.setex
.calledWith(
`clsiserver:${this.project_id}:${this.user_id}`,
this.settings.clsiCookie.ttl,
this.settings.clsiCookie.ttlInSeconds,
'clsi-8'
)
.should.equal(true)