isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 5d6741a9a8ba71ae94ae15f9bd79f34d8d785ea4
parent 8df1f5dd646d165a9a8fb90f57c3a8872ab3ce7a
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sun, 12 Jul 2020 17:21:15 +0200

streamline counting of currently pushed messages wrt. expiration

don't count them as alive just to ignore them in the next step.

Diffstat:
Msrc/sync.c | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/sync.c b/src/sync.c @@ -1657,10 +1657,15 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux for (tmsg = svars->msgs[N]; tmsg; tmsg = tmsg->next) { if (tmsg->status & M_DEAD) continue; - if ((srec = tmsg->srec) && srec->uid[F] && - ((tmsg->flags | srec->aflags[N]) & ~srec->dflags[N] & F_DELETED) && - !(srec->status & (S_EXPIRE|S_EXPIRED))) { - /* Message was not propagated yet, or is deleted. */ + if (!(srec = tmsg->srec) || !srec->uid[F]) { + // The message was not propagated, so it doesn't count towards the total. + // Note that we also ignore messages we're currently propagating, which + // delays expiry of some messages by one cycle. Otherwise, we'd have to + // sequence flag propagation after message propagation to avoid a race + // with 3rd-party expunging, and that seems unreasonable. + } else if (((tmsg->flags | srec->aflags[N]) & ~srec->dflags[N] & F_DELETED) && + !(srec->status & (S_EXPIRE|S_EXPIRED))) { + // The paired message is being deleted. } else { alive++; } @@ -1678,7 +1683,6 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux if (!(srec = tmsg->srec) || !srec->uid[F]) { /* We did not push the message, so it must be kept. */ debug( " message %u unpropagated\n", tmsg->uid ); - todel--; } else { nflags = (tmsg->flags | srec->aflags[N]) & ~srec->dflags[N]; if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) {