Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4DA21431FC2 for ; Tue, 23 Dec 2014 13:48:11 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id awc6dy1+vZiE for ; Tue, 23 Dec 2014 13:48:08 -0800 (PST) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 1D908431FBF for ; Tue, 23 Dec 2014 13:48:08 -0800 (PST) Received: from smtp01.caltech.edu (localhost [127.0.0.1]) by filter-return (Postfix) with ESMTP id 65208A0737 for ; Tue, 23 Dec 2014 13:48:07 -0800 (PST) X-Spam-Scanned: at Caltech-IMSS on smtp01.caltech.edu by amavisd-new Received: from finestructure.net (user-38o13sb.cable.mindspring.com [209.128.143.139]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jrollins) by smtp-server.its.caltech.edu (Postfix) with ESMTPSA id 8BEACA062E for ; Tue, 23 Dec 2014 13:48:06 -0800 (PST) Received: by finestructure.net (Postfix, from userid 1000) id 1561060132; Tue, 23 Dec 2014 13:48:05 -0800 (PST) From: Jameson Graef Rollins To: Notmuch Mail Subject: questions about post-new/insert hooks User-Agent: Notmuch/0.19+9~gdca38d0 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Tue, 23 Dec 2014 13:48:02 -0800 Message-ID: <87k31im419.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2014 21:48:11 -0000 --=-=-= Content-Type: text/plain Hi, folks. I was wondering about possible race conditions in the post-new hook. Given that the database does not remain locked during execution of the post-new hook, isn't there a possibility that more new messages will be added to the database before the post-new hook has finished processing? If so, I can imagine multiple ways that might break typical logic in post-new hooks. I wonder if this race condition could be avoided by e.g. sending the post-new hook the message ids of all newly-added messages on stdin. The hook could then use the message ids to process just the new messages, without worrying that other messages could have been added in the middle of processing. Has anyone thought about this? I was also wondering about per-message insertion hooks. The new(ish) insert command has a post-insert hook which is run on a per-message insertion basis. What about adding a hook that would run on each message being added with new? This would also be a way to get rid of the above mentioned race condition, and might allow for simpler message content filtering for those of us using notmuch-new instead of notmuch-insert. Maybe in this the per-message hook could get the full text of the message on stdin, and the message id as argument. I haven't fully thought the implications of this stuff through, so I would love to hear what others think. The reason I bring all this up is that I'm trying to figure out the best way to integrate spam classification into my notmuch setup, which for some reason is currently proving exceedingly difficult. jamie. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUmeMSAAoJEO00zqvie6q8Ax8P/2It5iz5Zo2C4S1Agp06jiZC HdEJiAy5TQCoslofytzhPj3SgK6Px90qLKyTiJ9Luu7yH551GlSt91T6jxL6r67t 5S2lISOFJFWS43cOPE1C0vi+Qyp+VGpHT3b0rxDYOMTwE3zPM3labfGrz51EFyxK LQnu2UkV0MF/GZsJHkOheDEKUQp53dd/4ON4udR/9qoW+EP2XaMlnT10aIi0lSBw ljinFMd00v7jCJrNmTdwk3+hNCRGM6o+mlVKGU8zzNWulvi1TJsFjAPm5e60h8jO WGkHak4rhleiiO3FKhgbzRoJITPLd9LDavAmJ55RsXXa0wWTqeQwxJdjxa5+vH3o GWk0aoshFxWof/tGChaUGsTh6sj2rvl+W+SSL6RMVm+eTis4XQ+BdQrjnDVCsXzi P7vxoOE4/0/bCh6y93GHsIhWQgdTHkiSjOuah5U9fcTzE3aMTLil9fyJR4WkOiJP 1+UOJHKRvgAKt8RTOWArAyZG+HIA+Zq8Ix30eVnf0chtGjPA+275bVbl8N6Nf7yd bM3PrI73PvJvnpuuvALy0dklgrTQr2humqPIFivKWruWTq2GQb8QJHF3qye5Rt78 4dxckg/lgyDKP7y8xZO86a+lqiseLulh8CC6Zcmvusnl7a5SVVzd2/hlvL01Hncy w/3PA7EXWXmW/wyAAyX1 =3QK9 -----END PGP SIGNATURE----- --=-=-=--