Fix repository cleanup after removal and expiration (#782)

This commit is contained in:
Thomas Durieux
2026-08-20 12:52:19 +02:00
committed by GitHub
parent 46e956a779
commit 35c3b1804b
8 changed files with 370 additions and 69 deletions
+5 -5
View File
@@ -331,11 +331,11 @@ export default class AnonymizedFile {
});
}
const content = await this.repository.source?.getFileContent(this);
if (
!this.repository.model.isReseted ||
this.repository.status != RepositoryStatus.READY
) {
this.repository.model.isReseted = false;
const cacheWasReset = this.repository.model.isReseted;
if (cacheWasReset) {
await this.repository.markCachePresent();
}
if (cacheWasReset || this.repository.status != RepositoryStatus.READY) {
await this.repository.updateStatus(RepositoryStatus.READY);
}
return content;
+14
View File
@@ -543,6 +543,20 @@ export default class Repository {
}
}
/**
* Record that repository content has been cached again after a reset.
*/
async markCachePresent() {
if (!this.model.isReseted) return;
this.model.isReseted = false;
if (isConnected) {
await AnonymizedRepositoryModel.updateOne(
{ _id: this._model._id },
{ $set: { isReseted: false } }
).exec();
}
}
/**
* Compute the size of the repository in term of storage and number of files.
*