From patchwork Tue Apr 14 06:21:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1270128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 491b432gHbz9sSt for ; Tue, 14 Apr 2020 16:21:55 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.a=rsa-sha256 header.s=google header.b=WKGoiyxZ; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 491b426ZL3zDqWW for ; Tue, 14 Apr 2020 16:21:54 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::632; helo=mail-pl1-x632.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.a=rsa-sha256 header.s=google header.b=WKGoiyxZ; dkim-atps=neutral Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 491b3F4NPRzDqWg for ; Tue, 14 Apr 2020 16:21:13 +1000 (AEST) Received: by mail-pl1-x632.google.com with SMTP id t4so4278072plq.12 for ; Mon, 13 Apr 2020 23:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7p8NqHWlqn/8EVKJIVOnuBcZ58K34zBz1eRiBPP/1IM=; b=WKGoiyxZ6Hzld/ehp3r8J9XHcqYt1GncoMvEIwC4ITgF+EeSMKSCpaQgwbrTDyMRlB SDxQ4hbfSpcGBD+65a8t4O9cg7r7qh89SN6MS03fn046cjqcHMkCyguZ9pfE35wbQcT9 6TT+cH4dp7DMaHyKWoaBPccNHRI6tRDy0QpH0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7p8NqHWlqn/8EVKJIVOnuBcZ58K34zBz1eRiBPP/1IM=; b=W2JwdIAoPDhdlddl8H1gHBOMU0ylYieR54gi1GGZPkI4ZvhuS35o0eF3yzrgTvLGPg 5cEPKODqYrMx4ngqsyc8d4lNzDlUh9QOeF88BGvC2SGX0fOqnL1Gh6+6iRMRaI5KXcHK KjVp8HeCcmTq9CUbxT6hGRTc8Vq5tWZUQzGz/YQnxGSvhzgO34XDJFJvvFVEPLFXrzh+ YEF7hTXztditW3SQQ/23adv0XSEsVIbgJnvdSm2Mqlf1joFaRKZ4OfE4Jjaf+gMQJEEG Hhx7H8EIgDXLEbRbadmuVqiU+s8dm2mlaI43k4e597KsTPBD5Pv1nZqWFx+xkKExrJ8d L0Kw== X-Gm-Message-State: AGi0PuZBzV1qgDI9sRSlwPaxslGX6+oHMBeOqhi5qbAn4aoEvGWEcrCd +0It75aHRgaF0fqhNBfPSyNaxXsOmeg= X-Google-Smtp-Source: APiQypJYg/I2NNjgnbZJtC7oiAaMcw8wd9B2WbGL7Uz3o6q6Mla3fQIiatD4CUbFgCt2SauLyHWiyg== X-Received: by 2002:a17:902:8506:: with SMTP id bj6mr21236597plb.106.1586845270364; Mon, 13 Apr 2020 23:21:10 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-65ed-ce52-e9b0-0e8c.static.ipv6.internode.on.net. [2001:44b8:1113:6700:65ed:ce52:e9b0:e8c]) by smtp.gmail.com with ESMTPSA id x16sm7702964pfm.146.2020.04.13.23.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 23:21:09 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 1/2] api: do not fetch every patch in a patch detail view 404 Date: Tue, 14 Apr 2020 16:21:01 +1000 Message-Id: <20200414062102.6798-2-dja@axtens.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414062102.6798-1-dja@axtens.net> References: <20200414062102.6798-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Ellerman , Stephen Rothwell , jk@ozlabs.org Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" mpe and jk and sfr found that the OzLabs server was melting due to some queries downloading every patch. Turns out if you 404 the patch detail view in the API, d-r-f attempts to render a listbox with every single patch to fill in the 'related' field. The bundle API also has a similar field. Replace the multiple selection box with a text field. You can still (AIUI) populate the relevant patch IDs manually. Reported-by: Jeremy Kerr Reported-by: Michael Ellerman Reported-by: Stephen Rothwell Signed-off-by: Daniel Axtens Tested-by: Jeremy Kerr Reviewed-by: Stephen Finucane --- patchwork/api/bundle.py | 3 ++- patchwork/api/embedded.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/patchwork/api/bundle.py b/patchwork/api/bundle.py index b8c0f1781786..54a9266e7d73 100644 --- a/patchwork/api/bundle.py +++ b/patchwork/api/bundle.py @@ -62,7 +62,8 @@ class BundleSerializer(BaseHyperlinkedModelSerializer): project = ProjectSerializer(read_only=True) mbox = SerializerMethodField() owner = UserSerializer(read_only=True) - patches = PatchSerializer(many=True, required=True) + patches = PatchSerializer(many=True, required=True, + style={'base_template': 'input.html'}) def get_web_url(self, instance): request = self.context.get('request') diff --git a/patchwork/api/embedded.py b/patchwork/api/embedded.py index 85a30cae1cdf..cb3f07e6b998 100644 --- a/patchwork/api/embedded.py +++ b/patchwork/api/embedded.py @@ -141,7 +141,8 @@ class PatchSerializer(SerializedRelatedField): class PatchRelationSerializer(BaseHyperlinkedModelSerializer): """Hide the PatchRelation model, just show the list""" - patches = PatchSerializer(many=True) + patches = PatchSerializer(many=True, + style={'base_template': 'input.html'}) def to_internal_value(self, data): if not isinstance(data, type([])):