mirror of
https://github.com/ansible/awx.git
synced 2026-04-22 02:10:23 -02:30
AC-984 Prevent signal handlers from being run unnecessarily when deleting inventory, remove unnecessary extra queries, use update_fields when possible.
This commit is contained in:
@@ -6,7 +6,7 @@ import inspect
|
||||
import json
|
||||
|
||||
# Django
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.http import Http404
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.template.loader import render_to_string
|
||||
@@ -428,4 +428,4 @@ class RetrieveUpdateDestroyAPIView(RetrieveUpdateAPIView, generics.RetrieveUpdat
|
||||
obj.mark_inactive()
|
||||
else:
|
||||
raise NotImplementedError('destroy() not implemented yet for %s' % obj)
|
||||
return HttpResponse(status=204)
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
@@ -34,6 +34,7 @@ from awx.main.licenses import LicenseReader
|
||||
from awx.main.models import *
|
||||
from awx.main.utils import *
|
||||
from awx.main.access import get_user_queryset
|
||||
from awx.main.signals import ignore_inventory_computed_fields, ignore_inventory_group_removal
|
||||
from awx.api.authentication import JobTaskAuthentication
|
||||
from awx.api.permissions import *
|
||||
from awx.api.serializers import *
|
||||
@@ -619,6 +620,11 @@ class InventoryDetail(RetrieveUpdateDestroyAPIView):
|
||||
model = Inventory
|
||||
serializer_class = InventorySerializer
|
||||
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
with ignore_inventory_computed_fields():
|
||||
with ignore_inventory_group_removal():
|
||||
return super(InventoryDetail, self).destroy(request, *args, **kwargs)
|
||||
|
||||
class InventoryActivityStreamList(SubListAPIView):
|
||||
|
||||
model = ActivityStream
|
||||
|
||||
Reference in New Issue
Block a user