From 8283d6f9fd4c226104a3f1fd84b0b15c2bf694ca Mon Sep 17 00:00:00 2001 From: nolouch Date: Tue, 2 Jul 2024 18:04:53 +0800 Subject: [PATCH] address Signed-off-by: nolouch --- client/resource_group/controller/config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/resource_group/controller/config.go b/client/resource_group/controller/config.go index 9b7bdcbeeee..96c783455bb 100644 --- a/client/resource_group/controller/config.go +++ b/client/resource_group/controller/config.go @@ -83,7 +83,7 @@ const ( defaultAvgBatchProportion = 0.7 ) -// LocalBucketRPCParams is the parameters for local bucket RPC. +// TokenRPCParams is the parameters for local bucket RPC. type TokenRPCParams struct { // WaitRetryInterval is the interval to retry when waiting for the token. WaitRetryInterval Duration `toml:"wait-retry-interval" json:"wait-retry-interval"` @@ -125,6 +125,14 @@ type Config struct { // Adjust adjusts the configuration. func (c *Config) Adjust() { + // valid the configuration, TODO: separately add the valid function. + if c.BaseConfig.LTBMaxWaitDuration.Duration == 0 { + c.BaseConfig.LTBMaxWaitDuration = NewDuration(defaultMaxWaitDuration) + } + if c.LocalBucketConfig.WaitRetryInterval.Duration == 0 { + c.LocalBucketConfig.WaitRetryInterval = NewDuration(defaultWaitRetryInterval) + } + // adjust the client settings. calculate the retry times. if int(c.BaseConfig.LTBTokenRPCMaxDelay.Duration) != int(c.LocalBucketConfig.WaitRetryInterval.Duration)*c.LocalBucketConfig.WaitRetryTimes { c.LocalBucketConfig.WaitRetryTimes = int(c.BaseConfig.LTBTokenRPCMaxDelay.Duration / c.LocalBucketConfig.WaitRetryInterval.Duration) }