增加节点订阅消息丢失重连
This commit is contained in:
@@ -202,7 +202,12 @@ class Cluster():
|
|||||||
|
|
||||||
def subscribe(self):
|
def subscribe(self):
|
||||||
while True:
|
while True:
|
||||||
message = self.pubsub.get_message()
|
try:
|
||||||
|
message = self.pubsub.get_message()
|
||||||
|
except RuntimeError as err:
|
||||||
|
if 'args' in dir(err) and err.args[0].find('pubsub connection not set') >= 0: # 失去重连
|
||||||
|
self.pubsub.subscribe(self.KEY_CHANNEL_LOG, self.KEY_CHANNEL_EVENT)
|
||||||
|
continue
|
||||||
if message:
|
if message:
|
||||||
if message.get('type') == 'message' and message.get('channel') == self.KEY_CHANNEL_LOG and message.get(
|
if message.get('type') == 'message' and message.get('channel') == self.KEY_CHANNEL_LOG and message.get(
|
||||||
'data'):
|
'data'):
|
||||||
|
|||||||
Reference in New Issue
Block a user