Fix potential autoreconnect problem and add exponential backoff

This commit is contained in:
Tulir Asokan
2019-05-28 14:09:49 +03:00
parent 498c0e4130
commit 7f0c67168c
3 changed files with 25 additions and 11 deletions

View File

@ -35,6 +35,7 @@ type BridgeConfig struct {
ConnectionTimeout int `yaml:"connection_timeout"`
MaxConnectionAttempts int `yaml:"max_connection_attempts"`
ConnectionRetryDelay int `yaml:"connection_retry_delay"`
ReportConnectionRetry bool `yaml:"report_connection_retry"`
InitialChatSync int `yaml:"initial_chat_sync_count"`
@ -56,6 +57,7 @@ type BridgeConfig struct {
func (bc *BridgeConfig) setDefaults() {
bc.ConnectionTimeout = 20
bc.MaxConnectionAttempts = 3
bc.ConnectionRetryDelay = -1
bc.ReportConnectionRetry = true
bc.InitialChatSync = 10