def connect(self, endpoint):
if self.connected:
return
try:
self.log.info('insecurely-connecting', endpoint=endpoint)
self.channel = grpc.insecure_channel(endpoint)
self.connected = True
self.log.info('insecurely-connected', endpoint=endpoint)
return
except _Rendezvous, e:
if e.code() == grpc.StatusCode.UNAVAILABLE:
self.log.info('grpc-endpoint-not-available')
else:
self.log.exception(e)
except Exception, e:
self.log.exception('cannot-connect', endpoint=endpoint)
评论列表
文章目录