mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 00:07:00 +01:00
fix: retain replacement reservations and bound expiration extensions
This commit is contained in:
1 parent
d7a5243054
commit
afd7a8ff3b
5 files changed
+46
-4
No files matched your search
@@ -978,7 +978,7 @@ export default class Repository {
|
||||
/**
|
||||
* Remove the repository
|
||||
*/
|
||||
async remove(expected?: { accessRevision?: string }) {
|
||||
async remove(expected?: { accessRevision?: string; replacement?: boolean }) {
|
||||
if (expected) {
|
||||
// Claim the lifecycle before deleting files; migration rejects REMOVING.
|
||||
this.assertNotArchived();
|
||||
@@ -992,7 +992,8 @@ export default class Repository {
|
||||
await this.updateStatus(RepositoryStatus.REMOVING);
|
||||
}
|
||||
await this.resetSate();
|
||||
await this.updateStatus(RepositoryStatus.REMOVED);
|
||||
// A source replacement retains its reservation throughout cache retirement.
|
||||
await this.updateStatus(expected?.replacement ? RepositoryStatus.PREPARING : RepositoryStatus.REMOVED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -205,6 +205,7 @@ router.post(
|
||||
const newExpiration = extendExpirationDate(
|
||||
repo.model.options.expirationDate
|
||||
);
|
||||
validateBillingExpiration({ ...repo.model.options, expirationDate: newExpiration });
|
||||
const reactivating = repo.status === RepositoryStatus.EXPIRED;
|
||||
const updates: Record<string, Date | string | null> = {
|
||||
"options.expirationDate": newExpiration,
|
||||
@@ -599,7 +600,7 @@ router.post(
|
||||
await reserveRepository(String(repo.model.owner), repo.repoId,
|
||||
files.reduce((sum, file) => sum + (file.size || 0), 0), repoUpdate.conference);
|
||||
}
|
||||
await repo.remove({ accessRevision: previousAccessRevision });
|
||||
await repo.remove({ accessRevision: previousAccessRevision, replacement: true });
|
||||
}
|
||||
|
||||
const removeRepoFromConference = async (conferenceID: string) => {
|
||||
|
||||
Reference in new issue
Block a user