Skip to content

Commit

Permalink
Merge branch 'develop' into fix/error-log
Browse files Browse the repository at this point in the history
  • Loading branch information
zouyx authored Jul 26, 2023
2 parents 6c40331 + 6a8a4cb commit d04017c
Show file tree
Hide file tree
Showing 6 changed files with 407 additions and 130 deletions.
16 changes: 8 additions & 8 deletions env/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Info struct {
nextTryConnTime int64
}

//GetServersLen 获取服务器数组
// GetServersLen 获取服务器数组
func GetServers(configIp string) map[string]*config.ServerInfo {
serverLock.Lock()
defer serverLock.Unlock()
Expand All @@ -53,7 +53,7 @@ func GetServers(configIp string) map[string]*config.ServerInfo {
return ipMap[configIp].serverMap
}

//GetServersLen 获取服务器数组长度
// GetServersLen 获取服务器数组长度
func GetServersLen(configIp string) int {
serverLock.Lock()
defer serverLock.Unlock()
Expand All @@ -72,7 +72,7 @@ func SetServers(configIp string, serverMap map[string]*config.ServerInfo) {
}
}

//SetDownNode 设置失效节点
// SetDownNode 设置失效节点
func SetDownNode(configService string, serverHost string) {
serverLock.Lock()
defer serverLock.Unlock()
Expand All @@ -99,15 +99,15 @@ func SetDownNode(configService string, serverHost string) {

for k, server := range s.serverMap {
// if some node has down then select next node
if strings.Index(k, serverHost) > -1 {
if strings.Contains(k, serverHost) {
server.IsDown = true
}
}
}

//IsConnectDirectly is connect by ip directly
//false : yes
//true : no
// IsConnectDirectly is connect by ip directly
// false : yes
// true : no
func IsConnectDirectly(configIp string) bool {
serverLock.Lock()
defer serverLock.Unlock()
Expand All @@ -122,7 +122,7 @@ func IsConnectDirectly(configIp string) bool {
return false
}

//SetNextTryConnTime if this connect is fail will set this time
// SetNextTryConnTime if this connect is fail will set this time
func SetNextTryConnTime(configIp string, nextPeriod int64) {
serverLock.Lock()
defer serverLock.Unlock()
Expand Down
8 changes: 3 additions & 5 deletions extension/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ import (

"github.com/apolloconfig/agollo/v4/env/config"

"github.com/apolloconfig/agollo/v4/env/file"
. "github.com/tevid/gohamcrest"
)

type TestFileHandler struct {
}

//WriteConfigFile 写入配置文件
// WriteConfigFile 写入配置文件
func (r *TestFileHandler) WriteConfigFile(config *config.ApolloConfig, configPath string) error {
return nil
}

//GetConfigFile 获得配置文件路径
// GetConfigFile 获得配置文件路径
func (r *TestFileHandler) GetConfigFile(configDir string, appID string, namespace string) string {
return ""
}
Expand All @@ -48,6 +47,5 @@ func TestSetFileHandler(t *testing.T) {

fileHandler := GetFileHandler()

b := fileHandler.(file.FileHandler)
Assert(t, b, NotNilVal())
Assert(t, fileHandler, NotNilVal())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/apolloconfig/agollo/v4

require (
github.com/spf13/viper v1.7.1
github.com/spf13/viper v1.8.1
github.com/tevid/gohamcrest v1.1.1
)

Expand Down
Loading

0 comments on commit d04017c

Please sign in to comment.