[VOL-1862] rwCore waits for Kafka and KV Store
This commit consists of the following:
1) Make the rw_core wait for kafka and KV Store to be up before
proceeding with its processing. Previously, rw_core would have
bailed out if kafka/KV was not available. The number of retries
(default=-1, i.e retry forever) and retry interval are both
configurable.
2) Remove a non-json printable variable from the debug log in the
model.
Change-Id: I8d1ef90bf5d202a6f8ae59610aa780292b2844ce
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index 41d96f4..133b1a4 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -52,6 +52,8 @@
default_CoreTimeout = int64(500)
default_CoreBindingKey = "voltha_backend_name"
default_CorePairTopic = "rwcore_1"
+ default_MaxConnectionRetries = -1 // retries forever
+ default_ConnectionRetryInterval = 2 // in seconds
)
// RWCoreFlags represents the set of configurations used by the read-write core service
@@ -84,6 +86,8 @@
DefaultCoreTimeout int64
CoreBindingKey string
CorePairTopic string
+ MaxConnectionRetries int
+ ConnectionRetryInterval int
}
func init() {
@@ -120,6 +124,8 @@
DefaultCoreTimeout: default_CoreTimeout,
CoreBindingKey: default_CoreBindingKey,
CorePairTopic: default_CorePairTopic,
+ MaxConnectionRetries: default_MaxConnectionRetries,
+ ConnectionRetryInterval: default_ConnectionRetryInterval,
}
return &rwCoreFlag
}
@@ -201,5 +207,11 @@
help = fmt.Sprintf("Core pairing group topic")
flag.StringVar(&cf.CorePairTopic, "core_pair_topic", default_CorePairTopic, help)
+ help = fmt.Sprintf("The number of retries to connect to a dependent component")
+ flag.IntVar(&(cf.MaxConnectionRetries), "max_connection_retries", default_MaxConnectionRetries, help)
+
+ help = fmt.Sprintf("The number of seconds between each connection retry attempt ")
+ flag.IntVar(&(cf.ConnectionRetryInterval), "connection_retry_interval", default_ConnectionRetryInterval, help)
+
flag.Parse()
}