Skip to content

Commit

Permalink
replication: Don't send notification for changes done by dsync transa…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
sirainen authored and villesavolainen committed Feb 14, 2018
1 parent 28be759 commit 3fcdc8d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/plugins/replication/replication-plugin.c
Expand Up @@ -37,6 +37,7 @@ struct replication_user {
struct replication_mail_txn_context {
struct mail_namespace *ns;
bool new_messages;
bool sync_trans;
};

static MODULE_CONTEXT_DEFINE_INIT(replication_user_module,
Expand Down Expand Up @@ -215,6 +216,10 @@ replication_mail_transaction_begin(struct mailbox_transaction_context *t)

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;
}

Expand Down Expand Up @@ -252,7 +257,8 @@ replication_mail_transaction_commit(void *txn,
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;
Expand Down

0 comments on commit 3fcdc8d

Please sign in to comment.