1.18.0 performance items: tests, the reference budget gate tightened (JS 195 kB, 404 without its exception, TTL check), docs (performance.md, AGENT.md, iapl-performance, module pages, api.md), changelog: what changes for an existing site
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d628839235
commit
f0127ac1b8
@@ -51,13 +51,13 @@ export async function syncTtlIndex(
|
||||
return 'dropped'
|
||||
}
|
||||
// records from before 1.18.0 (or written by another path): the TTL counts from their own date
|
||||
await coll.updateMany({ [TTL_FIELD]: { $exists: false }, [from]: { $type: 'date' } }, [{ $set: { [TTL_FIELD]: `$${from}` } }])
|
||||
await coll.updateMany({ [from]: { $type: 'date' }, [TTL_FIELD]: { $exists: false } }, [{ $set: { [TTL_FIELD]: `$${from}` } }])
|
||||
const seconds = Math.round(days * 86_400)
|
||||
if (!existing) {
|
||||
await coll.createIndex({ [TTL_FIELD]: 1 }, { expireAfterSeconds: seconds, name: TTL_INDEX })
|
||||
await coll.createIndex({ [TTL_FIELD]: 1 }, { name: TTL_INDEX, expireAfterSeconds: seconds })
|
||||
return 'created'
|
||||
}
|
||||
if (existing.expireAfterSeconds === seconds) {return 'none'}
|
||||
await db.connection!.db!.command({ collMod: coll.collectionName, index: { expireAfterSeconds: seconds, name: TTL_INDEX } })
|
||||
await db.connection!.db!.command({ collMod: coll.collectionName, index: { name: TTL_INDEX, expireAfterSeconds: seconds } })
|
||||
return 'updated'
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ export function withVersionLimit<T extends Versioned>(entity: T, kind: 'collecti
|
||||
if (!v) {return entity}
|
||||
const key = kind === 'global' ? 'max' : 'maxPerDoc'
|
||||
if (v === true) {return { ...entity, versions: { [key]: limit } }}
|
||||
if (typeof v === 'object' && typeof (v as Record<string, unknown>)[key] !== 'number') {return { ...entity, versions: { ...(v as object), [key]: limit } }}
|
||||
if (typeof v === 'object' && typeof (v as Record<string, unknown>)[key] !== 'number') {return { ...entity, versions: { ...(v), [key]: limit } }}
|
||||
return entity
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user