Skip to content

Commit

Permalink
replication: Don't trigger replication on changes not visible to dsync
Browse files Browse the repository at this point in the history
For example if there's a write to .cache file, it doesn't require
replication.
  • Loading branch information
sirainen authored and cmouse committed Feb 13, 2018
1 parent 8828d7a commit 3a2098a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/plugins/replication/replication-plugin.c
Expand Up @@ -251,6 +251,15 @@ static void replication_mail_copy(void *txn, struct mail *src,
}
}

static bool
replication_want_sync_changes(const struct mail_transaction_commit_changes *changes)
{
/* Replication needs to be triggered on all the user-visible changes,
but not e.g. due to writes to cache file. */
return (changes->changes_mask &
~MAIL_INDEX_TRANSACTION_CHANGE_OTHERS) != 0;
}

static void
replication_mail_transaction_commit(void *txn,
struct mail_transaction_commit_changes *changes)
Expand All @@ -262,7 +271,7 @@ replication_mail_transaction_commit(void *txn,
enum replication_priority priority;

if (ruser != NULL && !ctx->sync_trans &&
(ctx->new_messages || changes->changes_mask != 0)) {
(ctx->new_messages || replication_want_sync_changes(changes))) {
priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW :
ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH :
REPLICATION_PRIORITY_SYNC;
Expand Down

0 comments on commit 3a2098a

Please sign in to comment.