From nobody Fri Oct 18 06:16:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail header.i=fam@euphon.net; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543415776493207.24566305377778; Wed, 28 Nov 2018 06:36:16 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48D8A3084217; Wed, 28 Nov 2018 14:36:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 353B9611CA; Wed, 28 Nov 2018 14:36:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 289924A460; Wed, 28 Nov 2018 14:36:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wASEaDNV031793 for ; Wed, 28 Nov 2018 09:36:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 40AB019493; Wed, 28 Nov 2018 14:36:13 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F77A1948E; Wed, 28 Nov 2018 14:36:13 +0000 (UTC) Received: from sender1.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by mx1.redhat.com (Postfix) with ESMTP id F2506C058CD8; Wed, 28 Nov 2018 14:36:08 +0000 (UTC) Received: from localhost.localdomain (123.112.65.99 [123.112.65.99]) by mx.zoho.com.cn with SMTPS id 1543415763872120.4758134394915; Wed, 28 Nov 2018 22:36:03 +0800 (CST) ARC-Seal: i=1; a=rsa-sha256; t=1543415767; cv=none; d=zoho.com.cn; s=zohoarc; b=EHjx/4WHI4XwnuXTLLARlsYo9oFsYR4CGYNGBI7j4FFlWOQK2psRhsPAr8Q0OZaGUg4sHIZtubg80JMtyZSRxN7ovkbqoX6t94UeIOViTBQu0zXKMjEnwrkA/ok4a/+S23FvHvdSBUytY3okcDJy7R/scxIXKBxoGkbsSj38m1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1543415767; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=yr3dqWjwa0Q74aQhWTfrjNayv2bQFOIhqW40qBlkG6E=; b=OHUl9oleimx7+o22e9+0lXVV2LC08An8tCORaooC96SSvNBudjJ/XDfYYroz6smKdfTBunK0yPhhUamGy5mLaz+MgD9kvlLjxn8Ll444Yt6UgnSzOIv/fJdfNA2NLRQz2GPXMl0w9cGSxFJ/B2fa694od20t+I9pCeqV7xUTyuE= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1543415767; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=1769; bh=yr3dqWjwa0Q74aQhWTfrjNayv2bQFOIhqW40qBlkG6E=; b=ZmYbC/TgmNCsDab2cbAvyhI0vbBnCkkX2jV9XX6V5BmvBCjGf7ZAdawEAet96sjQ Q3ooPLSzESRB5JS7BZtEYQGFZaiz0LHxxVGpfV+aE4B1gFDX0kb8RHZA7G3MDo1Yxnq L6qVSne85r9K1Axn2hB+2p5C/EAXPZoNtXnGxOpQ= From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 28 Nov 2018 22:35:02 +0800 Message-Id: <20181128143505.27730-10-fam@euphon.net> In-Reply-To: <20181128143505.27730-1-fam@euphon.net> References: <20181128143505.27730-1-fam@euphon.net> X-ZohoCNMailClient: External X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 28 Nov 2018 14:36:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 28 Nov 2018 14:36:11 +0000 (UTC) for IP:'163.53.93.243' DOMAIN:'sender2-op-o12.zoho.com.cn' HELO:'sender1.zoho.com.cn' FROM:'fam@euphon.net' RCPT:'' X-RedHat-Spam-Score: -0.101 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_PASS) 163.53.93.243 sender2-op-o12.zoho.com.cn 163.53.93.243 sender2-op-o12.zoho.com.cn X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: patchew-devel@redhat.com Cc: Fam Zheng Subject: [Patchew-devel] [PATCH v2 09/12] maintainer: Add MessageQueued and MessageDropping events X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 28 Nov 2018 14:36:15 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Fam Zheng These events are not used internally but is an interesting point where users can receive notifications when the watched queue is updated. Signed-off-by: Fam Zheng --- mods/maintainer.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/maintainer.py b/mods/maintainer.py index d342748..6b09057 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -16,7 +16,7 @@ from mod import PatchewModule from api.models import Message, Queue, WatchedQuery from django.shortcuts import render from api.search import SearchEngine -from event import register_handler +from event import declare_event, register_handler, emit_event =20 class MaintainerModule(PatchewModule): """ Project maintainer related tasks """ @@ -25,14 +25,24 @@ class MaintainerModule(PatchewModule): =20 def __init__(self): register_handler("ResultUpdate", self.on_result_update) + declare_event("MessageQueued", + message=3D"Message added", + queue=3D"The updated queue") + declare_event("MessageDropping", + message=3D"Message to be dropped", + queue=3D"Message is about to be dropping from a queu= e") =20 def _add_to_queue(self, user, m, queue): for x in [m] + list(m.get_patches()): - Queue.objects.get_or_create(user=3Duser, message=3Dx, name=3Dq= ueue) + q, created =3D Queue.objects.get_or_create(user=3Duser, messag= e=3Dx, name=3Dqueue) + if created: + emit_event("MessageQueued", message=3Dx, queue=3Dq) =20 def _drop_from_queue(self, user, m, queue): query =3D Queue.objects.filter(user=3Duser, message__in=3Dm.get_pa= tches() + [m], name=3Dqueue) + for q in query: + emit_event("MessageDropping", message=3Dq.message, queue=3Dq) q.delete() =20 def _update_watch_queue(self, series): --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel