Merge pull request #14836 from overleaf/ab-split-test-cache-refactoring

[web] Fetch all active split test into cache at once

GitOrigin-RevId: b477b88bf281349433af2cf692a0e9ea5b036588
This commit is contained in:
Alexandre Bourdin
2023-10-17 08:03:17 +00:00
committed by Copybot
parent 719da5fbd8
commit b8a5eca1d0
4 changed files with 60 additions and 33 deletions
@@ -57,6 +57,16 @@ async function getSplitTests({ name, phase, type, active, archived }) {
}
}
async function getRuntimeTests() {
try {
return await SplitTest.find({
archived: { $ne: true },
}).exec()
} catch (error) {
throw OError.tag(error, 'Failed to get active split tests list')
}
}
async function getSplitTest(query) {
try {
return await SplitTest.findOne(query)
@@ -439,6 +449,7 @@ function _mergeFlags(incomingTests, baseTests) {
module.exports = {
getSplitTest,
getSplitTests,
getRuntimeTests,
createSplitTest,
updateSplitTestConfig,
updateSplitTestInfo,