Python/thaw/freeze: Different references to same message

William Pettersson william at ewpettersson.se
Sat Jul 29 04:58:50 PDT 2017


Hey,

I've been trying to emulate something similar to what Ben Gamari shows
in https://notmuchmail.org/pipermail/notmuch/2011/003976.html and I ran
into an issue.

That script (which admittedly is from 6 years ago) freezes messages
before changing tags. But when changing tags, new searches are often
run, returning some of the same results. It seems any changes on these
"inner" messages are lost when the outer messages are thawed, and I'm
guessing this is because the "inner" and "outer" messages reference
different objects in memory which point to the same Xapian document.

I've attached a short script which demonstrates this, to test it you
need at least one message tagged with "this_is_my_test", but the script
is fairly simple.

Now If I'm correct in guessing the issue here, I can understand that
it's not the sort of thing that is fun to fix, so I'm more looking to
see if my understanding is right. In particular, I'm asking because
clearly 6 years ago Ben's scripts worked, so maybe I'm just not
understanding them/notmuch correctly.

If I am right, then I'll just leave out the freezing/thawing. As it
stands, I'm only adding ~5-10 emails at most each run (which is every 10
minutes) so performance when adding emails isn't (yet) an issue for me.

Will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_nm.py
Type: text/x-python
Size: 645 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20170729/ba531672/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20170729/ba531672/attachment.sig>


More information about the notmuch mailing list