Skip to content

Commit 9990537

Browse files
committed
Support python3
1 parent 52c8d81 commit 9990537

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

dubbo/client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,17 @@ def __init__(self, hosts, application_name='search_platform'):
120120
:param hosts: Zookeeper的地址
121121
:param application_name: 当前客户端的名称
122122
"""
123+
self.hosts = {}
124+
self.weights = {}
125+
self.application_name = application_name
126+
self.lock = threading.Lock()
127+
123128
zk = KazooClient(hosts=hosts)
124129
# 对zookeeper连接状态的监控
125130
zk.add_listener(self.state_listener)
126131
zk.start()
127132

128133
self.zk = zk
129-
self.hosts = {}
130-
self.weights = {}
131-
self.application_name = application_name
132-
self.lock = threading.Lock()
133134

134135
def state_listener(self, state):
135136
"""
@@ -145,10 +146,9 @@ def state_listener(self, state):
145146
else:
146147
logger.debug('Connected or disconnected to zookeeper.')
147148

148-
# TODO
149149
# 在新的线程里面进行重新订阅以防止死锁
150-
# t = threading.Thread(target=self.__resubscribe)
151-
# t.start()
150+
t = threading.Thread(target=self.__resubscribe)
151+
t.start()
152152

153153
def __resubscribe(self):
154154
"""

0 commit comments

Comments
 (0)