Merge pull request #28628 from overleaf/bg-cache-history-size-on-project

Implement project size checks on file uploads

GitOrigin-RevId: 4dffe237e6992b859f07964cffa82ff1c13e91c9
This commit is contained in:
Brian Gough
2025-09-24 08:07:37 +00:00
committed by Copybot
parent daa4bd9062
commit d7cd65d20c
5 changed files with 183 additions and 69 deletions
@@ -0,0 +1,34 @@
/* eslint-disable no-unused-vars */
import Helpers from './lib/helpers.mjs'
const tags = ['saas']
const indexes = [
{
key: { lastUpdatedAt: 1 },
expireAfterSeconds: 60 * 60 * 24 * 30 /* 30 days */,
name: 'projectHistorySizes_lastUpdatedAt_ttl_1',
},
{
key: { estimatedSize: 1 },
name: 'projectHistorySizes_estimatedSize_1',
},
]
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.projectHistorySizes, indexes)
}
const rollback = async client => {
const { db } = client
await Helpers.dropIndexesFromCollection(db.projectHistorySizes, indexes)
}
export default {
tags,
migrate,
rollback,
}