فهرست منبع

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

GitOrigin-RevId: bd29aa1f77d61b5ff0c2c0a7d6fa893509c89e37
Jakob Ackermann 7 ماه پیش
والد
کامیت
72ad614b25

+ 2 - 18
services/web/app/src/Features/Compile/ClsiCookieManager.mjs

@@ -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(
   async function getServerId(
     projectId,
     projectId,
     userId,
     userId,
@@ -51,14 +43,9 @@ const ClsiCookieManagerFactory = function (backendGroup) {
     if (!clsiCookiesEnabled) {
     if (!clsiCookiesEnabled) {
       return
       return
     }
     }
-    let serverId = await rclient.get(
+    const serverId = await rclient.get(
       buildKey(projectId, userId, compileBackendClass)
       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) {
     if (!serverId) {
       return await cookieManager.promises._populateServerIdViaRequest(
       return await cookieManager.promises._populateServerIdViaRequest(
@@ -229,10 +216,7 @@ const ClsiCookieManagerFactory = function (backendGroup) {
       return
       return
     }
     }
     try {
     try {
-      await rclient.del(
-        buildKey(projectId, userId, compileBackendClass),
-        buildOldKey(projectId, userId)
-      )
+      await rclient.del(buildKey(projectId, userId, compileBackendClass))
     } catch (err) {
     } catch (err) {
       // redis errors need wrapping as the instance may be shared
       // redis errors need wrapping as the instance may be shared
       throw new OError(
       throw new OError(

+ 2 - 25
services/web/test/unit/src/Compile/ClsiCookieManager.test.mjs

@@ -63,28 +63,6 @@ describe('ClsiCookieManager', function () {
       serverId.should.equal('clsi-7')
       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) {
     it('should _populateServerIdViaRequest if no key is found', async function (ctx) {
       ctx.ClsiCookieManager.promises._populateServerIdViaRequest = sinon
       ctx.ClsiCookieManager.promises._populateServerIdViaRequest = sinon
         .stub()
         .stub()
@@ -185,15 +163,14 @@ describe('ClsiCookieManager', function () {
   })
   })
 
 
   describe('clearServerId', 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(
       await ctx.ClsiCookieManager.promises.clearServerId(
         ctx.project_id,
         ctx.project_id,
         ctx.user_id,
         ctx.user_id,
         'c3d'
         'c3d'
       )
       )
       ctx.redis.del.should.have.been.calledWith(
       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}`
       )
       )
     })
     })
   })
   })