mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
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 { RateLimiter } = require('../../infrastructure/RateLimiter')
|
||||
const UserAnalyticsIdCache = require('../Analytics/UserAnalyticsIdCache')
|
||||
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||
const {
|
||||
callbackify,
|
||||
callbackifyMultiResult,
|
||||
@@ -123,6 +124,18 @@ async function getProjectCompileLimits(projectId) {
|
||||
if (owner && owner.alphaProgram) {
|
||||
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 compileGroup =
|
||||
|
||||
@@ -736,6 +736,17 @@ const _ProjectController = {
|
||||
isOverleafAssistBundleEnabled &&
|
||||
(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
|
||||
if (!planCode && !userInNonIndividualSub) {
|
||||
planCode = 'personal'
|
||||
@@ -843,7 +854,7 @@ const _ProjectController = {
|
||||
customerIoEnabled,
|
||||
addonPrices,
|
||||
compileSettings: {
|
||||
compileTimeout: ownerFeatures?.compileTimeout,
|
||||
compileTimeout,
|
||||
},
|
||||
})
|
||||
timer.done()
|
||||
|
||||
@@ -45,6 +45,9 @@ describe('CompileManager', function () {
|
||||
'../Analytics/UserAnalyticsIdCache': (this.UserAnalyticsIdCache = {
|
||||
get: sinon.stub().resolves('abc'),
|
||||
}),
|
||||
'../SplitTests/SplitTestHandler': (this.SplitTestHandler = {
|
||||
promises: {},
|
||||
}),
|
||||
},
|
||||
})
|
||||
this.project_id = 'mock-project-id-123'
|
||||
|
||||
Reference in New Issue
Block a user