provisionning: delete roles in one query when deprovisionning (#55043)
This commit is contained in:
parent
5dc88fc9a7
commit
6e896dbcdd
|
@ -198,8 +198,7 @@ class NotificationProcessing:
|
|||
if full and action == 'provision':
|
||||
Role.objects.exclude(uuid__in=uuids).delete()
|
||||
elif action == 'deprovision':
|
||||
for role in Role.objects.filter(uuid__in=uuids):
|
||||
role.delete()
|
||||
Role.objects.filter(uuid__in=uuids).delete()
|
||||
|
||||
@classmethod
|
||||
def provision(cls, object_type, issuer, action, data, full):
|
||||
|
|
|
@ -338,7 +338,7 @@ def test_hobo_notify_roles_db_queries(caplog, tenants):
|
|||
}
|
||||
with CaptureQueriesContext(connection) as ctx:
|
||||
Command.process_notification(tenant, notification)
|
||||
assert len(ctx.captured_queries) == 39
|
||||
assert len(ctx.captured_queries) == 15
|
||||
|
||||
assert Group.objects.count() == 0
|
||||
assert Role.objects.count() == 0
|
||||
|
|
Loading…
Reference in New Issue