From 0295c7bf0167a4d76adfeade214aae97610e1bde Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 19 Jul 2025 11:13:25 -0700 Subject: [PATCH] improve the comment --- services/org/org.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/services/org/org.go b/services/org/org.go index 13221e28958..43aa32485c8 100644 --- a/services/org/org.go +++ b/services/org/org.go @@ -48,11 +48,14 @@ func deleteOrganization(ctx context.Context, org *org_model.Organization) error // DeleteOrganization completely and permanently deletes everything of organization. func DeleteOrganization(ctx context.Context, org *org_model.Organization, purge bool) error { - // The repositories deletion of the organization cannot be under a transaction, - // because it cannot be rolled back because the content in disk will be deleted - // in the DeleteOwnerRepositoriesDirectly function. - // Even not all repositories deleted successfully, we still delete the organization again. - // TODO: We should mark all the repositories as deleted and delete them in a background job. + // Deleting repositories under the organization cannot be wrapped in a transaction at the moment, + // because the associated disk content is permanently deleted by the DeleteOwnerRepositoriesDirectly function, + // which cannot be rolled back. + // + // Even if some repositories fail to delete, the organization will still be deleted. + // + // TODO: Consider marking repositories as "deleted" first, + // and handling the actual deletion in a background job for better reliability and rollback support. if purge { err := repo_service.DeleteOwnerRepositoriesDirectly(ctx, org.AsUser()) if err != nil {