Skip to content

Commit

Permalink
fix:plugs
Browse files Browse the repository at this point in the history
  • Loading branch information
fangao committed Jun 30, 2023
1 parent 8e87616 commit cc829c5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion application/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Plugin interface {

func Plugs(plugins ...Plugin) error {
for _, plug := range plugins {
config.LoadCustomConfig(plug.Config)
config.LoadCustomConfig(plug.Config())
if err := plug.InitPlugin(); err != nil {
return err
}
Expand Down
6 changes: 1 addition & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,10 @@ func LoadCustomConfig(configs ...interface{}) {
if err := vip.ReadInConfig(); err != nil {
panic(err)
}
err := vip.Unmarshal(&Conf)
if err != nil {
panic(err)
}

// 加载自定义配置
for i, _ := range configs {
err = vip.Unmarshal(&configs[i])
err := vip.Unmarshal(&configs[i])
if err != nil {
panic(err)
}
Expand Down
6 changes: 6 additions & 0 deletions go-dandelion-cli/internal/template/common/common.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package lib

type Response struct {
Code int32 `json:"-"`
Msg string `json:"-"`
}
9 changes: 9 additions & 0 deletions go-dandelion-cli/internal/template/common/ping.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package {{ .ServerName }}

type (
PingParams struct {
}

PingResp struct {
}
)
19 changes: 11 additions & 8 deletions server/rpcx/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
zkClient "github.com/rpcxio/rpcx-zookeeper/client"
"github.com/smallnest/rpcx/client"
"github.com/smallnest/rpcx/protocol"
"github.com/smallnest/rpcx/share"
"time"
)

Expand Down Expand Up @@ -108,14 +109,16 @@ func option() client.Option {
}

opt := client.Option{
Retries: 10, // 重试次数
TimeToDisallow: time.Minute, // 30秒内不会对失败的服务器进行重试
ConnectTimeout: 3 * time.Second, // 连接超时
IdleTimeout: 10 * time.Second, // 最大空闲时间
BackupLatency: 10 * time.Millisecond,
SerializeType: protocol.MsgPack,
CompressType: protocol.None,
TCPKeepAlivePeriod: time.Minute,
Retries: 10, // 重试次数
RPCPath: share.DefaultRPCPath,
TimeToDisallow: time.Minute, // 30秒内不会对失败的服务器进行重试
ConnectTimeout: time.Second, // 连接超时
BackupLatency: 10 * time.Millisecond,
SerializeType: protocol.MsgPack,
CompressType: protocol.None,
TCPKeepAlivePeriod: time.Minute,
MaxWaitForHeartbeat: 30 * time.Second,
BidirectionalBlock: false,
}

return opt
Expand Down

0 comments on commit cc829c5

Please sign in to comment.