Python/thaw/freeze: Different references to same message

David Bremner david at tethera.net
Mon Jul 31 14:20:00 PDT 2017


William Pettersson <william at ewpettersson.se> writes:

> 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.

That sounds likely to be the case. There's no attempt to synchronize
multiple in memory caches of the same xapian document.

> 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.

You might try begin_atomic / end_atomic instead. These nest properly by
design, although I'm not so confident about the performance impact
(they're not really focussed on performance).


More information about the notmuch mailing list