-
Notifications
You must be signed in to change notification settings - Fork 0
refactor/getty #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pkg/client/client.go
Outdated
| // initRemoting init remoting | ||
| func initRemoting(cfg *Config) { | ||
| getty.InitRpcClient(&cfg.GettyConfig, &remoteConfig.SeataConfig{ | ||
| SeataConfig := remoteConfig.SeataConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be lowercase , change to seataConfig := xxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/remoting/getty/getty_remoting.go
Outdated
| mergeMsgMap: &sync.Map{}, | ||
| } | ||
| }) | ||
| func NewGettyRemoting() *GettyRemoting { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewGettyRemoting -> newGettyRemoting 包外不能访问
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已将 NewGettyRemoting 改为 newGettyRemoting,限制包外访问
| func initSessionManager(gettyConfig *config.Config, seataConfig *config.SeataConfig) { | ||
| sessionManager = &SessionManager{ | ||
| allSessions: sync.Map{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用sync.Once保证只初始化一次会不会好一点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| func (f *clientOnResponseProcessor) Process(ctx context.Context, rpcMessage message.RpcMessage) error { | ||
| log.Infof("the rm client received clientOnResponse msg %#v from tc server.", rpcMessage) | ||
| client := getty.GetGettyRemotingClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client 换个名字,不是很清晰的一个命名,maybe gettyClient or something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改进了变量命名,将 client 改为更明确的 gettyRemotingClient
pkg/remoting/getty/listener.go
Outdated
| msgFutures *sync.Map | ||
| mergeMsgMap *sync.Map |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得这两个好像没用,讨论的时候说是不是可以删除掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移除了 gettyClientHandler 中未使用的 msgFutures 和 mergeMsgMap 字段
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: