unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* questions about post-new/insert hooks
@ 2014-12-23 21:48 Jameson Graef Rollins
  0 siblings, 0 replies; only message in thread
From: Jameson Graef Rollins @ 2014-12-23 21:48 UTC (permalink / raw)
  To: Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 1575 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-23 21:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-23 21:48 questions about post-new/insert hooks Jameson Graef Rollins

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).