mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 21:01:33 +02:00
Merge pull request #508 from sharelatex/ja-fix-clsi-cookie-cluster
Check for blank string in clsi cookie caching
This commit is contained in:
@@ -19,10 +19,10 @@ module.exports = ClsiCookieManager =
|
||||
rclient.get buildKey(project_id), (err, serverId)->
|
||||
if err?
|
||||
return callback(err)
|
||||
if serverId?
|
||||
return callback(null, serverId)
|
||||
else
|
||||
if !serverId? or serverId == ""
|
||||
return ClsiCookieManager._populateServerIdViaRequest project_id, callback
|
||||
else
|
||||
return callback(null, serverId)
|
||||
|
||||
|
||||
_populateServerIdViaRequest :(project_id, callback = (err, serverId)->)->
|
||||
|
||||
@@ -60,6 +60,13 @@ describe "ClsiCookieManager", ->
|
||||
@ClsiCookieManager._populateServerIdViaRequest.calledWith(@project_id).should.equal true
|
||||
done()
|
||||
|
||||
it "should _populateServerIdViaRequest if no key is blank", (done)->
|
||||
@ClsiCookieManager._populateServerIdViaRequest = sinon.stub().callsArgWith(1)
|
||||
@redis.get.callsArgWith(1, null, "")
|
||||
@ClsiCookieManager._getServerId @project_id, (err, serverId)=>
|
||||
@ClsiCookieManager._populateServerIdViaRequest.calledWith(@project_id).should.equal true
|
||||
done()
|
||||
|
||||
|
||||
describe "_populateServerIdViaRequest", ->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user