streamline counting of currently pushed messages wrt. expiration
don't count them as alive just to ignore them in the next step.
This commit is contained in:
parent
8df1f5dd64
commit
5d6741a9a8
14
src/sync.c
14
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) {
|
for (tmsg = svars->msgs[N]; tmsg; tmsg = tmsg->next) {
|
||||||
if (tmsg->status & M_DEAD)
|
if (tmsg->status & M_DEAD)
|
||||||
continue;
|
continue;
|
||||||
if ((srec = tmsg->srec) && srec->uid[F] &&
|
if (!(srec = tmsg->srec) || !srec->uid[F]) {
|
||||||
((tmsg->flags | srec->aflags[N]) & ~srec->dflags[N] & F_DELETED) &&
|
// The message was not propagated, so it doesn't count towards the total.
|
||||||
!(srec->status & (S_EXPIRE|S_EXPIRED))) {
|
// Note that we also ignore messages we're currently propagating, which
|
||||||
/* Message was not propagated yet, or is deleted. */
|
// 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 {
|
} else {
|
||||||
alive++;
|
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]) {
|
if (!(srec = tmsg->srec) || !srec->uid[F]) {
|
||||||
/* We did not push the message, so it must be kept. */
|
/* We did not push the message, so it must be kept. */
|
||||||
debug( " message %u unpropagated\n", tmsg->uid );
|
debug( " message %u unpropagated\n", tmsg->uid );
|
||||||
todel--;
|
|
||||||
} else {
|
} else {
|
||||||
nflags = (tmsg->flags | srec->aflags[N]) & ~srec->dflags[N];
|
nflags = (tmsg->flags | srec->aflags[N]) & ~srec->dflags[N];
|
||||||
if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) {
|
if (!(nflags & F_DELETED) || (srec->status & (S_EXPIRE|S_EXPIRED))) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user