questions about post-new/insert hooks
Jameson Graef Rollins
jrollins at finestructure.net
Tue Dec 23 13:48:02 PST 2014
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20141223/cf2fda97/attachment.pgp>
More information about the notmuch
mailing list