From 28ecbcf9de14a3ed0c2352d1e3be95fbc9e64cad Mon Sep 17 00:00:00 2001 From: everpcpc Date: Tue, 14 Jul 2020 18:00:12 +0800 Subject: [PATCH] feat: support disable retry sync for canal --- canal/canal.go | 1 + canal/config.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/canal/canal.go b/canal/canal.go index 62c63410e..a80887c99 100644 --- a/canal/canal.go +++ b/canal/canal.go @@ -424,6 +424,7 @@ func (c *Canal) prepareSyncer() error { ParseTime: c.cfg.ParseTime, SemiSyncEnabled: c.cfg.SemiSyncEnabled, MaxReconnectAttempts: c.cfg.MaxReconnectAttempts, + DisableRetrySync: c.cfg.DisableRetrySync, TimestampStringLocation: c.cfg.TimestampStringLocation, TLSConfig: c.cfg.TLSConfig, } diff --git a/canal/config.go b/canal/config.go index be8cdbe8a..b24c2a2da 100644 --- a/canal/config.go +++ b/canal/config.go @@ -77,10 +77,13 @@ type Config struct { // SemiSyncEnabled enables semi-sync or not. SemiSyncEnabled bool `toml:"semi_sync_enabled"` - // Set to change the maximum number of attempts to re-establish a broken - // connection + // maximum number of attempts to re-establish a broken connection, zero or negative number means infinite retry. + // this configuration will not work if DisableRetrySync is true MaxReconnectAttempts int `toml:"max_reconnect_attempts"` + // whether disable re-sync for broken connection + DisableRetrySync bool `toml:"disable_retry_sync"` + // Set TLS config TLSConfig *tls.Config }