Merge pull request #27677 from overleaf/as-compile-timeout-enforcement
[web] 10s Compile Timeout - Enforcement Phase GitOrigin-RevId: 3930eb376cc1293409259e073032218e09d5270e
This commit is contained in:
@@ -10,6 +10,7 @@ const ClsiManager = require('./ClsiManager')
|
|||||||
const Metrics = require('@overleaf/metrics')
|
const Metrics = require('@overleaf/metrics')
|
||||||
const { RateLimiter } = require('../../infrastructure/RateLimiter')
|
const { RateLimiter } = require('../../infrastructure/RateLimiter')
|
||||||
const UserAnalyticsIdCache = require('../Analytics/UserAnalyticsIdCache')
|
const UserAnalyticsIdCache = require('../Analytics/UserAnalyticsIdCache')
|
||||||
|
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||||
const {
|
const {
|
||||||
callbackify,
|
callbackify,
|
||||||
callbackifyMultiResult,
|
callbackifyMultiResult,
|
||||||
@@ -123,6 +124,18 @@ async function getProjectCompileLimits(projectId) {
|
|||||||
if (owner && owner.alphaProgram) {
|
if (owner && owner.alphaProgram) {
|
||||||
ownerFeatures.compileGroup = 'alpha'
|
ownerFeatures.compileGroup = 'alpha'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ownerFeatures.compileTimeout === 20) {
|
||||||
|
const overrideCompileTimeout =
|
||||||
|
await SplitTestHandler.promises.getAssignmentForUser(
|
||||||
|
project.owner_ref,
|
||||||
|
'10s-timeout-enforcement'
|
||||||
|
)
|
||||||
|
|
||||||
|
if (overrideCompileTimeout.variant === 'enabled') {
|
||||||
|
ownerFeatures.compileTimeout = 10
|
||||||
|
}
|
||||||
|
}
|
||||||
const analyticsId = await UserAnalyticsIdCache.get(owner._id)
|
const analyticsId = await UserAnalyticsIdCache.get(owner._id)
|
||||||
|
|
||||||
const compileGroup =
|
const compileGroup =
|
||||||
|
|||||||
@@ -736,6 +736,17 @@ const _ProjectController = {
|
|||||||
isOverleafAssistBundleEnabled &&
|
isOverleafAssistBundleEnabled &&
|
||||||
(await ProjectController._getAddonPrices(req, res))
|
(await ProjectController._getAddonPrices(req, res))
|
||||||
|
|
||||||
|
const reducedTimeout =
|
||||||
|
await SplitTestHandler.promises.getAssignmentForUser(
|
||||||
|
project.owner_ref,
|
||||||
|
'10s-timeout-enforcement'
|
||||||
|
)
|
||||||
|
|
||||||
|
let compileTimeout = ownerFeatures?.compileTimeout
|
||||||
|
if (compileTimeout === 20 && reducedTimeout.variant === 'enabled') {
|
||||||
|
compileTimeout = 10
|
||||||
|
}
|
||||||
|
|
||||||
let planCode = subscription?.planCode
|
let planCode = subscription?.planCode
|
||||||
if (!planCode && !userInNonIndividualSub) {
|
if (!planCode && !userInNonIndividualSub) {
|
||||||
planCode = 'personal'
|
planCode = 'personal'
|
||||||
@@ -843,7 +854,7 @@ const _ProjectController = {
|
|||||||
customerIoEnabled,
|
customerIoEnabled,
|
||||||
addonPrices,
|
addonPrices,
|
||||||
compileSettings: {
|
compileSettings: {
|
||||||
compileTimeout: ownerFeatures?.compileTimeout,
|
compileTimeout,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
timer.done()
|
timer.done()
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ describe('CompileManager', function () {
|
|||||||
'../Analytics/UserAnalyticsIdCache': (this.UserAnalyticsIdCache = {
|
'../Analytics/UserAnalyticsIdCache': (this.UserAnalyticsIdCache = {
|
||||||
get: sinon.stub().resolves('abc'),
|
get: sinon.stub().resolves('abc'),
|
||||||
}),
|
}),
|
||||||
|
'../SplitTests/SplitTestHandler': (this.SplitTestHandler = {
|
||||||
|
promises: {},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
this.project_id = 'mock-project-id-123'
|
this.project_id = 'mock-project-id-123'
|
||||||
|
|||||||
Reference in New Issue
Block a user