mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 12:02:13 +00:00
Merge pull request #509 from sharelatex/ja-fix-clsi-cookie-cluster
Don't try to set the server id if it isn't returned in the response
This commit is contained in:
commit
76b8fecde9
2 changed files with 8 additions and 1 deletions
|
@ -44,6 +44,8 @@ module.exports = ClsiCookieManager =
|
|||
if !clsiCookiesEnabled
|
||||
return callback()
|
||||
serverId = ClsiCookieManager._parseServerIdFromResponse(response)
|
||||
if !serverId? # We don't get a cookie back if it hasn't changed
|
||||
return callback()
|
||||
if rclient_secondary?
|
||||
@_setServerIdInRedis rclient_secondary, project_id, serverId
|
||||
@_setServerIdInRedis rclient, project_id, serverId, (err) ->
|
||||
|
|
|
@ -105,13 +105,18 @@ describe "ClsiCookieManager", ->
|
|||
serverId.should.equal "clsi-8"
|
||||
done()
|
||||
|
||||
|
||||
it "should not set the server id if clsiCookies are not enabled", (done)->
|
||||
delete @settings.clsiCookie.key
|
||||
@ClsiCookieManager = SandboxedModule.require modulePath, requires:@requires
|
||||
@ClsiCookieManager.setServerId @project_id, @response, (err, serverId)=>
|
||||
@redisMulti.exec.called.should.equal false
|
||||
done()
|
||||
|
||||
it "should not set the server id there is no server id in the response", (done)->
|
||||
@ClsiCookieManager._parseServerIdFromResponse = sinon.stub().returns(null)
|
||||
@ClsiCookieManager.setServerId @project_id, @response, (err, serverId)=>
|
||||
@redisMulti.exec.called.should.equal false
|
||||
done()
|
||||
|
||||
it "should also set in the secondary if secondary redis is enabled", (done) ->
|
||||
@redisSecondaryMulti =
|
||||
|
|
Loading…
Reference in a new issue