mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Merge pull request #416 from ryanpetrello/stdout_defer
Add 3.1.5 result_stdout_text optimizations into 3.2 so we don't regress
This commit is contained in:
commit
ff385ddf17
@ -2668,6 +2668,12 @@ class InventoryUpdateList(ListAPIView):
|
|||||||
model = InventoryUpdate
|
model = InventoryUpdate
|
||||||
serializer_class = InventoryUpdateListSerializer
|
serializer_class = InventoryUpdateListSerializer
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
qs = super(InventoryUpdateList, self).get_queryset()
|
||||||
|
# TODO: remove this defer in 3.3 when we implement https://github.com/ansible/ansible-tower/issues/5436
|
||||||
|
qs = qs.defer('result_stdout_text')
|
||||||
|
return qs
|
||||||
|
|
||||||
|
|
||||||
class InventoryUpdateDetail(UnifiedJobDeletionMixin, RetrieveDestroyAPIView):
|
class InventoryUpdateDetail(UnifiedJobDeletionMixin, RetrieveDestroyAPIView):
|
||||||
|
|
||||||
|
@ -2084,6 +2084,7 @@ class UnifiedJobAccess(BaseAccess):
|
|||||||
# 'job_template__project',
|
# 'job_template__project',
|
||||||
# 'job_template__credential',
|
# 'job_template__credential',
|
||||||
#)
|
#)
|
||||||
|
# TODO: remove this defer in 3.3 when we implement https://github.com/ansible/ansible-tower/issues/5436
|
||||||
qs = qs.defer('result_stdout_text')
|
qs = qs.defer('result_stdout_text')
|
||||||
return qs.all()
|
return qs.all()
|
||||||
|
|
||||||
|
@ -145,3 +145,16 @@ activity_stream_registrar.connect(WorkflowJob)
|
|||||||
|
|
||||||
# prevent API filtering on certain Django-supplied sensitive fields
|
# prevent API filtering on certain Django-supplied sensitive fields
|
||||||
prevent_search(User._meta.get_field('password'))
|
prevent_search(User._meta.get_field('password'))
|
||||||
|
|
||||||
|
# Always, always, always defer result_stdout_text for polymorphic UnifiedJob rows
|
||||||
|
# TODO: remove this defer in 3.3 when we implement https://github.com/ansible/ansible-tower/issues/5436
|
||||||
|
def defer_stdout(f):
|
||||||
|
def _wrapped(*args, **kwargs):
|
||||||
|
objs = f(*args, **kwargs)
|
||||||
|
objs.query.deferred_loading[0].add('result_stdout_text')
|
||||||
|
return objs
|
||||||
|
return _wrapped
|
||||||
|
|
||||||
|
|
||||||
|
for cls in UnifiedJob.__subclasses__():
|
||||||
|
cls.base_objects.filter = defer_stdout(cls.base_objects.filter)
|
||||||
|
Loading…
Reference in New Issue
Block a user