-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
refactor: app.cluster auto bind this #570
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ module.exports = function(app) { | |
const done = app.readyCallback('register_client', { | ||
isWeakDep: app.config.runMode === 0, | ||
}); | ||
app.registryClient = app.cluster(RegistryClient).create(); | ||
const cluster = app.cluster; | ||
app.registryClient = cluster(RegistryClient).create(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. options.cluster = app.cluster;
app.registryClient = new RegistryClient(options); 这样才对的 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 哦,这里的 RegistryClient 是 DataClient |
||
app.registryClient.ready(done); | ||
|
||
app.registryClient.subscribe({ | ||
|
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.
等下 加个用例
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.
放这里有用么? 下面的 this 还是取不到吧,感觉需要将方法定义在下面,然后
this.cluster = this.cluster.bind(this)
?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.
他是 arrow function