fix: Fix channel manager bg checker exit when disable auto balance (#28459)

issue: #28454

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
pull/28576/head
wei liu 2023-11-20 18:20:22 +08:00 committed by GitHub
parent 13a5b9f64a
commit fdbca10e23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -262,7 +262,8 @@ func (c *ChannelManager) bgCheckChannelsWork(ctx context.Context) {
return
case <-ticker.C:
if !Params.DataCoordCfg.AutoBalance.GetAsBool() {
return
log.Info("auto balance disabled, skip auto bg check balance")
continue
}
c.mu.Lock()

View File

@ -1239,6 +1239,7 @@ func TestChannelManager_HelperFunc(t *testing.T) {
}
func TestChannelManager_BackgroundChannelChecker(t *testing.T) {
Params.Save(Params.DataCoordCfg.AutoBalance.Key, "false")
Params.Save(Params.DataCoordCfg.ChannelBalanceInterval.Key, "1")
Params.Save(Params.DataCoordCfg.ChannelBalanceSilentDuration.Key, "1")
@ -1279,7 +1280,6 @@ func TestChannelManager_BackgroundChannelChecker(t *testing.T) {
go c.bgCheckChannelsWork(ctx)
updateCounter := atomic.NewInt64(0)
mockStore.EXPECT().Update(mock.Anything).Run(func(op *ChannelOpSet) {
updateCounter.Inc()
}).Return(nil).Maybe()