[web] remove fallback for old clsi-server-id persistence (#30528)

GitOrigin-RevId: bd29aa1f77d61b5ff0c2c0a7d6fa893509c89e37
This commit is contained in:
Jakob Ackermann
2026-01-13 09:06:43 +00:00
committed by Copybot
parent 425e7b1e5b
commit 72ad614b25
2 changed files with 4 additions and 43 deletions
@@ -34,14 +34,6 @@ const ClsiCookieManagerFactory = function (backendGroup) {
}
}
function buildOldKey(projectId, userId) {
if (backendGroup != null) {
return `clsiserver:${backendGroup}:${projectId}:${userId}`
} else {
return `clsiserver:${projectId}:${userId}`
}
}
async function getServerId(
projectId,
userId,
@@ -51,14 +43,9 @@ const ClsiCookieManagerFactory = function (backendGroup) {
if (!clsiCookiesEnabled) {
return
}
let serverId = await rclient.get(
const serverId = await rclient.get(
buildKey(projectId, userId, compileBackendClass)
)
if (!serverId) {
// Fallback to the old key.
// TODO(das7pad): remove this in 24h.
serverId = await rclient.get(buildOldKey(projectId, userId))
}
if (!serverId) {
return await cookieManager.promises._populateServerIdViaRequest(
@@ -229,10 +216,7 @@ const ClsiCookieManagerFactory = function (backendGroup) {
return
}
try {
await rclient.del(
buildKey(projectId, userId, compileBackendClass),
buildOldKey(projectId, userId)
)
await rclient.del(buildKey(projectId, userId, compileBackendClass))
} catch (err) {
// redis errors need wrapping as the instance may be shared
throw new OError(
@@ -63,28 +63,6 @@ describe('ClsiCookieManager', function () {
serverId.should.equal('clsi-7')
})
it('should fallback to old key', async function (ctx) {
ctx.redis.get
.withArgs(`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`)
.resolves(null)
ctx.redis.get
.withArgs(`clsiserver:${ctx.project_id}:${ctx.user_id}`)
.resolves('clsi-7')
const serverId = await ctx.ClsiCookieManager.promises.getServerId(
ctx.project_id,
ctx.user_id,
'',
'c3d'
)
ctx.redis.get
.calledWith(`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`)
.should.equal(true)
ctx.redis.get
.calledWith(`clsiserver:${ctx.project_id}:${ctx.user_id}`)
.should.equal(true)
serverId.should.equal('clsi-7')
})
it('should _populateServerIdViaRequest if no key is found', async function (ctx) {
ctx.ClsiCookieManager.promises._populateServerIdViaRequest = sinon
.stub()
@@ -185,15 +163,14 @@ describe('ClsiCookieManager', function () {
})
describe('clearServerId', function () {
it('should clear both keys', async function (ctx) {
it('should clear the key', async function (ctx) {
await ctx.ClsiCookieManager.promises.clearServerId(
ctx.project_id,
ctx.user_id,
'c3d'
)
ctx.redis.del.should.have.been.calledWith(
`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`,
`clsiserver:${ctx.project_id}:${ctx.user_id}`
`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`
)
})
})