[web] move premium compiles up one bracket (#29410)

GitOrigin-RevId: 53423f855b2c215f6cc926b480422b2ce3477a74
This commit is contained in:
Jakob Ackermann
2025-10-31 09:36:47 +01:00
committed by Copybot
parent 046e74a2c6
commit 3a206074f2
6 changed files with 16 additions and 19 deletions
@@ -52,6 +52,8 @@ function getNewCompileBackendClass(projectId, compileBackendClass) {
return 'n4'
case 'c2d':
return 'n4'
case 'c4d':
return 'n4'
default:
throw new Error('unknown ?compileBackendClass')
}
@@ -279,12 +279,7 @@ const _CompileController = {
status,
compileTime: timings?.compileE2E,
timeout: limits.timeout,
server:
clsiServerId?.includes('-c2d-') ||
clsiServerId?.includes('-c3d-') ||
clsiServerId?.includes('-c4d-')
? 'faster'
: 'normal',
server: clsiServerId?.includes('-c4d-') ? 'faster' : 'normal',
clsiServerId,
isAutoCompile,
isInitialCompile: stats?.isInitialCompile === 1,
@@ -135,7 +135,7 @@ async function _getProjectCompileLimits(project) {
timeout:
ownerFeatures.compileTimeout || Settings.defaultFeatures.compileTimeout,
compileGroup,
compileBackendClass: compileGroup === 'standard' ? 'n2d' : 'c2d',
compileBackendClass: compileGroup === 'standard' ? 'n2d' : 'c4d',
ownerAnalyticsId: analyticsId,
}
return limits
@@ -852,7 +852,7 @@ describe('ClsiManager', function () {
ctx.project._id,
ctx.user_id,
{
compileBackendClass: 'c2d',
compileBackendClass: 'c4d',
compileGroup: 'priority',
}
)
@@ -868,7 +868,7 @@ describe('ClsiManager', function () {
url.host === CLSI_HOST &&
url.pathname ===
`/project/${ctx.project._id}/user/${ctx.user_id}/compile` &&
url.searchParams.get('compileBackendClass') === 'c2d' &&
url.searchParams.get('compileBackendClass') === 'c4d' &&
url.searchParams.get('compileGroup') === 'priority'
)
)
@@ -885,7 +885,7 @@ describe('ClsiManager', function () {
ctx.AnalyticsManager.recordEventForUserInBackground
).to.have.been.calledWith(ctx.user_id, 'double-compile-result', {
projectId: 'project-id',
compileBackendClass: 'c2d',
compileBackendClass: 'c4d',
newCompileBackendClass: 'n4',
status: 'success',
compileTime: 1337,
@@ -1055,7 +1055,7 @@ describe('ClsiManager', function () {
await ctx.ClsiManager.promises.deleteAuxFiles(
ctx.project._id,
ctx.user_id,
{ compileBackendClass: 'c2d', compileGroup: 'priority' },
{ compileBackendClass: 'c4d', compileGroup: 'priority' },
'node-1'
)
// wait for the background task to finish
@@ -1065,7 +1065,7 @@ describe('ClsiManager', function () {
it('should clear both cookies', function (ctx) {
expect(
ctx.ClsiCookieManager.promises.clearServerId
).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'c2d')
).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'c4d')
expect(
ctx.ClsiCookieManager.promises.clearServerId
).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'n4')
@@ -1078,7 +1078,7 @@ describe('ClsiManager', function () {
url.host === CLSI_HOST &&
url.pathname ===
`/project/${ctx.project._id}/user/${ctx.user_id}` &&
url.searchParams.get('compileBackendClass') === 'c2d' &&
url.searchParams.get('compileBackendClass') === 'c4d' &&
url.searchParams.get('compileGroup') === 'priority' &&
url.searchParams.get('clsiserverid') === 'node-1'
),
@@ -1168,7 +1168,7 @@ describe('ClsiManager', function () {
ctx.project._id,
ctx.user_id,
false,
{ compileBackendClass: 'c2d', compileGroup: 'priority' },
{ compileBackendClass: 'c4d', compileGroup: 'priority' },
'node-1'
)
// wait for the background task to finish
@@ -1180,7 +1180,7 @@ describe('ClsiManager', function () {
sinon.match(
url =>
url.toString() ===
`http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=c2d&compileGroup=priority&file=main.tex&image=mock-image-name&clsiserverid=node-1`
`http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=c4d&compileGroup=priority&file=main.tex&image=mock-image-name&clsiserverid=node-1`
)
)
expect(ctx.FetchUtils.fetchStringWithResponse).to.have.been.calledWith(
@@ -783,7 +783,7 @@ describe('CompileController', function () {
.stub()
.resolves({
compileGroup: 'priority',
compileBackendClass: 'c2d',
compileBackendClass: 'c4d',
})
await ctx.CompileController._proxyToClsi(
ctx.projectId,
@@ -798,7 +798,7 @@ describe('CompileController', function () {
it('should open a request to the CLSI', function (ctx) {
ctx.fetchUtils.fetchStreamWithResponse.should.have.been.calledWith(
`${ctx.settings.apis.clsi.url}${ctx.url}?compileGroup=priority&compileBackendClass=c2d`
`${ctx.settings.apis.clsi.url}${ctx.url}?compileGroup=priority&compileBackendClass=c4d`
)
})
})
@@ -254,7 +254,7 @@ describe('CompileManager', function () {
.calledWith(null, {
timeout: ctx.timeout,
compileGroup: ctx.group,
compileBackendClass: 'c2d',
compileBackendClass: 'c4d',
ownerAnalyticsId: 'abc',
})
.should.equal(true)
@@ -284,7 +284,7 @@ describe('CompileManager', function () {
await ctx.CompileManager.promises.getProjectCompileLimits(
ctx.project_id
)
expect(compileBackendClass).to.equal('c2d')
expect(compileBackendClass).to.equal('c4d')
})
})
})