Skip to content

Commit 7c9f4b5

Browse files
authored
fix(hybrid-cloud): Uncache organization when queueing it for deletion (#45213)
1 parent 6fff4a3 commit 7c9f4b5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/sentry/api/endpoints/organization_details.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ def handle_delete(self, request: Request, organization):
598598
transaction_id=schedule.guid,
599599
)
600600
organization.send_delete_confirmation(entry, ONE_DAY)
601+
Organization.objects.uncache_object(organization.id)
601602
context = serialize(
602603
organization,
603604
request.user,

tests/sentry/api/endpoints/test_organization_details.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,10 @@ def test_can_remove_as_owner(self):
819819
# No owners should be remaining
820820
assert len(owner_emails) == 0
821821

822+
# Ensure cache was flushed
823+
org = Organization.objects.get_from_cache(slug=org.slug)
824+
assert org.status == OrganizationStatus.PENDING_DELETION
825+
822826
def test_cannot_remove_as_admin(self):
823827
org = self.create_organization(owner=self.user)
824828
user = self.create_user(email="[email protected]", is_superuser=False)

0 commit comments

Comments
 (0)