Skip to content

Commit

Permalink
Update config_client.go
Browse files Browse the repository at this point in the history
executeConfigListen when rpc client reconnect
  • Loading branch information
tclxjing8-li authored Dec 31, 2024
1 parent 43cef86 commit 28fb525
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions clients/config_client/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/logger"
"github.com/nacos-group/nacos-sdk-go/v2/common/monitor"
"github.com/nacos-group/nacos-sdk-go/v2/common/nacos_error"
"github.com/nacos-group/nacos-sdk-go/v2/common/remote/rpc"
"github.com/nacos-group/nacos-sdk-go/v2/common/remote/rpc/rpc_request"
"github.com/nacos-group/nacos-sdk-go/v2/common/remote/rpc/rpc_response"
"github.com/nacos-group/nacos-sdk-go/v2/inner/uuid"
Expand Down Expand Up @@ -396,10 +397,12 @@ func (client *ConfigClient) startInternal() {
defer timer.Stop()
for {
select {
case <-rpc.ReconnectionChan:
client.executeConfigListen(true)
case <-client.listenExecute:
client.executeConfigListen()
client.executeConfigListen(false)
case <-timer.C:
client.executeConfigListen()
client.executeConfigListen(false)
case <-client.ctx.Done():
return
}
Expand All @@ -408,9 +411,9 @@ func (client *ConfigClient) startInternal() {
}()
}

func (client *ConfigClient) executeConfigListen() {
func (client *ConfigClient) executeConfigListen(immediatelySync bool) {
var (
needAllSync = time.Since(client.lastAllSyncTime) >= constant.ALL_SYNC_INTERNAL
needAllSync = time.Since(client.lastAllSyncTime) >= constant.ALL_SYNC_INTERNAL || immediatelySync
hasChangedKeys = false
)

Expand Down

0 comments on commit 28fb525

Please sign in to comment.