[RFC 07/11] REST: Add Patch Checks to the API

Andy Doan andy.doan at linaro.org
Fri May 13 05:04:04 AEST 2016

On 05/11/2016 03:57 AM, Finucane, Stephen wrote:
> On 10 May 17:30, Andy Doan wrote:
>> On 05/09/2016 08:58 AM, Finucane, Stephen wrote:
>>> On 15 Apr 13:24, Andy Doan wrote:

>>>> +patches_router = NestedSimpleRouter(router, r'patches', lookup='patch')
>>>> +patches_router.register(r'checks', ChecksViewSet, base_name='patch-checks')
>>>> +patches_router.register(r'check', CheckViewSet, base_name='patch-check')
>>> I think that 'check' would be more valuable as part of the 'patch'
>>> endpoint, rather than as a separate endpoint. The whole idea of 'check'
>>> is to provide a quick overview of the status, before delving into more
>>> detailed results via 'checks'.
>> The problem with putting "check" into the Patch endpoint is that we
>> have an explosion of DB hits (self.check_set.all() for each Patch).
> Had a similar issue with the patch list screen: that was resolved using
> 'prefetch_related' [1]. Seems like it's possible to do the same thing
> with DRF [2][3]?

great tip. i've fixed this in code. I'll include this in my v3 patch 
set. You want me to send that now, or wait till i get your feedback on 
my v2 set?

More information about the Patchwork mailing list