perf: bound request work and resource usage (#866)

* perf: bound request work and resource usage

* fix: address performance review regressions

* fix: guard content expiration and dashboard state

* fix: tolerate cache outages and retire derived paths

* fix: revalidate expiration claims and status pagination

* fix: retry interrupted repository metadata cleanup

* fix: retire obsolete content cache storage

* fix: activate tree metadata and recheck expiration claims

* fix: fence cache publication across expiration

* fix: recover staged trees and enforce cache lifecycle cleanup

* fix: prune expired transforms during database outages

* fix: finish conference removals and reload expiration candidates
This commit is contained in:
Thomas Durieux authored and GitHub committed 2026-10-08 03:38:19 +01:00
1 parent 32722169a2
commit 6434337923
74 files changed
+4752 -553

No files matched your search

+25 -4
View File
@@ -1,3 +1,5 @@
import { isConnected } from "../server/database";
import { expireEmbeddedContent } from "./content-expiration";
import { APP_PROVIDER, appError } from "./github-app";
import CredentialModel from "./model/credentials/credentials.model";
import { getCredentialToken } from "./credentials";
@@ -131,7 +133,7 @@ export default class Gist {
this._model.options.expirationDate
) {
if (this._model.options.expirationDate <= new Date()) {
await this.expire();
await this.markExpired();
}
}
if (
@@ -217,10 +219,29 @@ export default class Gist {
).exec();
}
async markExpired() {
const now = new Date();
if (isConnected) {
const result = await AnonymizedGistModel.updateOne({ _id: this.model._id,
status: RepositoryStatus.READY, "options.expirationMode": { $ne: "never" },
"options.expirationDate": { $lte: now },
}, { $set: { status: RepositoryStatus.EXPIRING, statusDate: now } }).exec();
if (!result.matchedCount) {
const current = await AnonymizedGistModel.findById(this.model._id).exec();
if (!current) throw new AnonymousError("gist_expired", { object: this, httpStatus: 410 });
this._model = current;
this._gistPayload = undefined;
return;
}
}
this.model.status = RepositoryStatus.EXPIRING;
this.model.statusDate = now;
}
async expire() {
await this.updateStatus(RepositoryStatus.EXPIRING);
await this.resetSate();
await this.updateStatus(RepositoryStatus.EXPIRED);
await expireEmbeddedContent(AnonymizedGistModel, this.model, {
"gist.comments": [], "gist.description": "", "gist.files": [], "gist.ownerLogin": "",
});
}
async remove() {