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

    streamline counting of currently pushed messages wrt. expiration
    
    don't count them as alive just to ignore them in the next step.

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

diff --git a/src/sync.c b/src/sync.c
index f274058..fc7cec6 100644
--- 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))) {


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to