Merge pull request #14803 from overleaf/jpa-split-test-cache-alpha-beta

[web] invalidate split test cache when alpha/beta program status changes

GitOrigin-RevId: 3023d2adf8466b48490c51497f5c80e7b0a1fe3d
This commit is contained in:
Jakob Ackermann
2023-09-14 08:04:12 +00:00
committed by Copybot
parent 7d3c8fb78d
commit 1e4dcc84d9
8 changed files with 99 additions and 3 deletions
@@ -427,6 +427,7 @@ const ProjectController = {
},
user(cb) {
if (userId == null) {
SplitTestHandler.sessionMaintenance(req, null, () => {})
cb(null, defaultSettingsForAnonymousUser(userId))
} else {
User.updateOne(
@@ -448,6 +449,7 @@ const ProjectController = {
return cb(err)
}
logger.debug({ projectId, userId }, 'got user')
SplitTestHandler.sessionMaintenance(req, user, () => {})
if (FeaturesUpdater.featuresEpochIsCurrent(user)) {
return cb(null, user)
}
@@ -101,7 +101,7 @@ async function projectListPage(req, res, next) {
})
const user = await User.findById(
userId,
`email emails features lastPrimaryEmailCheck signUpDate${
`email emails features alphaProgram betaProgram lastPrimaryEmailCheck signUpDate${
isSaas ? ' enrollment' : ''
}`
)
@@ -113,6 +113,8 @@ async function projectListPage(req, res, next) {
}
if (isSaas) {
await SplitTestHandler.promises.sessionMaintenance(req, user)
try {
usersBestSubscription =
await SubscriptionViewModelBuilder.promises.getBestSubscription({