You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by hu...@apache.org on 2019/11/08 05:20:47 UTC
[dubbo-js] branch master updated: Zookeeper ready之后再await dubbo.ready()会永远卡住
This is an automated email from the ASF dual-hosted git repository.
hufeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-js.git
The following commit(s) were added to refs/heads/master by this push:
new 4e65296 Zookeeper ready之后再await dubbo.ready()会永远卡住
new 10233ca Merge pull request #153 from sunchuanleihit/fix_dubbo_ready
4e65296 is described below
commit 4e65296be29f6730dc6f45ba1b26906cb612fe45
Author: sunchuanleihit <su...@163.com>
AuthorDate: Fri Nov 8 12:38:16 2019 +0800
Zookeeper ready之后再await dubbo.ready()会永远卡住
---
packages/dubbo/src/dubbo.ts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/packages/dubbo/src/dubbo.ts b/packages/dubbo/src/dubbo.ts
index b2a14ed..0791199 100644
--- a/packages/dubbo/src/dubbo.ts
+++ b/packages/dubbo/src/dubbo.ts
@@ -89,7 +89,9 @@ export default class Dubbo<TService = Object>
this._registryService(props.service);
log('interfaces:|>', this._interfaces);
- this._readyResolve = noop;
+ this._readyPromise = new Promise(resolve => {
+ this._readyResolve = resolve;
+ });
this._subscriber = {
onTrace: noop,
};
@@ -116,6 +118,7 @@ export default class Dubbo<TService = Object>
}
private _interfaces: Array<string>;
+ private _readyPromise: Promise<void>;
private _readyResolve: Function;
private _subscriber: IDubboSubscriber;
private readonly _queue: Queue;
@@ -237,9 +240,7 @@ export default class Dubbo<TService = Object>
* 其他的框架类似
*/
ready() {
- return new Promise(resolve => {
- this._readyResolve = resolve;
- });
+ return this._readyPromise;
}
subscribe(subscriber: IDubboSubscriber) {