Mercurial > dovecot > core-2.2
changeset 22831:b68382cc3b25
replication: Don't send notification for changes done by dsync transactions
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 06 Feb 2018 15:12:26 +0200 |
parents | cf5fd56a24d3 |
children | 2bff47454113 |
files | src/plugins/replication/replication-plugin.c |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/replication/replication-plugin.c Tue Feb 06 15:10:48 2018 +0200 +++ b/src/plugins/replication/replication-plugin.c Tue Feb 06 15:12:26 2018 +0200 @@ -37,6 +37,7 @@ struct replication_mail_txn_context { struct mail_namespace *ns; bool new_messages; + bool sync_trans; }; static MODULE_CONTEXT_DEFINE_INIT(replication_user_module, @@ -215,6 +216,10 @@ ctx = i_new(struct replication_mail_txn_context, 1); ctx->ns = mailbox_get_namespace(t->box); + if ((t->flags & MAILBOX_TRANSACTION_FLAG_SYNC) != 0) { + /* Transaction is from dsync. Don't trigger replication back. */ + ctx->sync_trans = TRUE; + } return ctx; } @@ -252,7 +257,8 @@ REPLICATION_USER_CONTEXT(ctx->ns->user); enum replication_priority priority; - if (ruser != NULL && (ctx->new_messages || changes->changed)) { + if (ruser != NULL && !ctx->sync_trans && + (ctx->new_messages || changes->changed)) { priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW : ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH : REPLICATION_PRIORITY_SYNC;