Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1270128/?format=api
{ "id": 1270128, "url": "http://patchwork.ozlabs.org/api/patches/1270128/?format=api", "web_url": "http://patchwork.ozlabs.org/project/patchwork/patch/20200414062102.6798-2-dja@axtens.net/", "project": { "id": 16, "url": "http://patchwork.ozlabs.org/api/projects/16/?format=api", "name": "Patchwork", "link_name": "patchwork", "list_id": "patchwork.lists.ozlabs.org", "list_email": "patchwork@lists.ozlabs.org", "web_url": "http://jk.ozlabs.org/projects/patchwork/", "scm_url": "git://github.com/getpatchwork/patchwork", "webscm_url": "https://github.com/getpatchwork/patchwork", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20200414062102.6798-2-dja@axtens.net>", "list_archive_url": null, "date": "2020-04-14T06:21:01", "name": "[1/2] api: do not fetch every patch in a patch detail view 404", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "740ba411ab17804359d78e9f0eb8fa4045141ff7", "submitter": { "id": 65792, "url": "http://patchwork.ozlabs.org/api/people/65792/?format=api", "name": "Daniel Axtens", "email": "dja@axtens.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/patchwork/patch/20200414062102.6798-2-dja@axtens.net/mbox/", "series": [ { "id": 170086, "url": "http://patchwork.ozlabs.org/api/series/170086/?format=api", "web_url": "http://patchwork.ozlabs.org/project/patchwork/list/?series=170086", "date": "2020-04-14T06:21:00", "name": "v2.2 fixups for OzLabs", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/170086/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1270128/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1270128/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "patchwork@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "patchwork@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 491b432gHbz9sSt\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2020 16:21:55 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 491b426ZL3zDqWW\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2020 16:21:54 +1000 (AEST)", "from mail-pl1-x632.google.com (mail-pl1-x632.google.com\n [IPv6:2607:f8b0:4864:20::632])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 491b3F4NPRzDqWg\n for <patchwork@lists.ozlabs.org>; Tue, 14 Apr 2020 16:21:13 +1000 (AEST)", "by mail-pl1-x632.google.com with SMTP id t4so4278072plq.12\n for <patchwork@lists.ozlabs.org>; Mon, 13 Apr 2020 23:21:13 -0700 (PDT)", "from localhost\n (2001-44b8-1113-6700-65ed-ce52-e9b0-0e8c.static.ipv6.internode.on.net.\n [2001:44b8:1113:6700:65ed:ce52:e9b0:e8c])\n by smtp.gmail.com with ESMTPSA id x16sm7702964pfm.146.2020.04.13.23.21.09\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2020 23:21:09 -0700 (PDT)" ], "Authentication-Results": [ "ozlabs.org;\n dmarc=none (p=none dis=none) header.from=axtens.net", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=axtens.net header.i=@axtens.net header.a=rsa-sha256\n header.s=google header.b=WKGoiyxZ;\n\tdkim-atps=neutral", "lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::632;\n helo=mail-pl1-x632.google.com; envelope-from=dja@axtens.net;\n receiver=<UNKNOWN>)", "lists.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=axtens.net", "lists.ozlabs.org; dkim=pass (1024-bit key;\n unprotected) header.d=axtens.net header.i=@axtens.net header.a=rsa-sha256\n header.s=google header.b=WKGoiyxZ; dkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=7p8NqHWlqn/8EVKJIVOnuBcZ58K34zBz1eRiBPP/1IM=;\n b=WKGoiyxZ6Hzld/ehp3r8J9XHcqYt1GncoMvEIwC4ITgF+EeSMKSCpaQgwbrTDyMRlB\n SDxQ4hbfSpcGBD+65a8t4O9cg7r7qh89SN6MS03fn046cjqcHMkCyguZ9pfE35wbQcT9\n 6TT+cH4dp7DMaHyKWoaBPccNHRI6tRDy0QpH0=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=7p8NqHWlqn/8EVKJIVOnuBcZ58K34zBz1eRiBPP/1IM=;\n b=W2JwdIAoPDhdlddl8H1gHBOMU0ylYieR54gi1GGZPkI4ZvhuS35o0eF3yzrgTvLGPg\n 5cEPKODqYrMx4ngqsyc8d4lNzDlUh9QOeF88BGvC2SGX0fOqnL1Gh6+6iRMRaI5KXcHK\n KjVp8HeCcmTq9CUbxT6hGRTc8Vq5tWZUQzGz/YQnxGSvhzgO34XDJFJvvFVEPLFXrzh+\n YEF7hTXztditW3SQQ/23adv0XSEsVIbgJnvdSm2Mqlf1joFaRKZ4OfE4Jjaf+gMQJEEG\n Hhx7H8EIgDXLEbRbadmuVqiU+s8dm2mlaI43k4e597KsTPBD5Pv1nZqWFx+xkKExrJ8d\n L0Kw==", "X-Gm-Message-State": "AGi0PuZBzV1qgDI9sRSlwPaxslGX6+oHMBeOqhi5qbAn4aoEvGWEcrCd\n +0It75aHRgaF0fqhNBfPSyNaxXsOmeg=", "X-Google-Smtp-Source": "\n APiQypJYg/I2NNjgnbZJtC7oiAaMcw8wd9B2WbGL7Uz3o6q6Mla3fQIiatD4CUbFgCt2SauLyHWiyg==", "X-Received": "by 2002:a17:902:8506:: with SMTP id\n bj6mr21236597plb.106.1586845270364;\n Mon, 13 Apr 2020 23:21:10 -0700 (PDT)", "From": "Daniel Axtens <dja@axtens.net>", "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 <patchwork.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/patchwork>,\n <mailto:patchwork-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/patchwork/>", "List-Post": "<mailto:patchwork@lists.ozlabs.org>", "List-Help": "<mailto:patchwork-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/patchwork>,\n <mailto:patchwork-request@lists.ozlabs.org?subject=subscribe>", "Cc": "Michael Ellerman <mpe@ellerman.id.au>,\n Stephen Rothwell <sfr@canb.auug.org.au>, jk@ozlabs.org", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org", "Sender": "\"Patchwork\"\n <patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>" }, "content": "mpe and jk and sfr found that the OzLabs server was melting due\nto some queries downloading every patch.\n\nTurns out if you 404 the patch detail view in the API, d-r-f attempts\nto render a listbox with every single patch to fill in the 'related'\nfield. The bundle API also has a similar field.\n\nReplace the multiple selection box with a text field. You can still\n(AIUI) populate the relevant patch IDs manually.\n\nReported-by: Jeremy Kerr <jk@ozlabs.org>\nReported-by: Michael Ellerman <mpe@ellerman.id.au>\nReported-by: Stephen Rothwell <sfr@canb.auug.org.au>\nSigned-off-by: Daniel Axtens <dja@axtens.net>\n---\n patchwork/api/bundle.py | 3 ++-\n patchwork/api/embedded.py | 3 ++-\n 2 files changed, 4 insertions(+), 2 deletions(-)", "diff": "diff --git a/patchwork/api/bundle.py b/patchwork/api/bundle.py\nindex b8c0f1781786..54a9266e7d73 100644\n--- a/patchwork/api/bundle.py\n+++ b/patchwork/api/bundle.py\n@@ -62,7 +62,8 @@ class BundleSerializer(BaseHyperlinkedModelSerializer):\n project = ProjectSerializer(read_only=True)\n mbox = SerializerMethodField()\n owner = UserSerializer(read_only=True)\n- patches = PatchSerializer(many=True, required=True)\n+ patches = PatchSerializer(many=True, required=True,\n+ style={'base_template': 'input.html'})\n \n def get_web_url(self, instance):\n request = self.context.get('request')\ndiff --git a/patchwork/api/embedded.py b/patchwork/api/embedded.py\nindex 85a30cae1cdf..cb3f07e6b998 100644\n--- a/patchwork/api/embedded.py\n+++ b/patchwork/api/embedded.py\n@@ -141,7 +141,8 @@ class PatchSerializer(SerializedRelatedField):\n \n class PatchRelationSerializer(BaseHyperlinkedModelSerializer):\n \"\"\"Hide the PatchRelation model, just show the list\"\"\"\n- patches = PatchSerializer(many=True)\n+ patches = PatchSerializer(many=True,\n+ style={'base_template': 'input.html'})\n \n def to_internal_value(self, data):\n if not isinstance(data, type([])):\n", "prefixes": [ "1/2" ] }