def __make_stub(self, is_stub_reuse=True):
if util.datetime_diff_in_mins(self.__stub_update_time) >= conf.STUB_REUSE_TIMEOUT or \
not is_stub_reuse or self.__stub is None:
util.logger.spam(f"StubManager:__make_stub is_stub_reuse({is_stub_reuse}) self.__stub({self.__stub})")
self.__stub = util.get_stub_to_server(self.__target, self.__stub_type, is_check_status=False)
# if self.__is_secure:
# # TODO need treat to secure channel but not yet
# channel = grpc.insecure_channel(self.__target)
# else:
# channel = grpc.insecure_channel(self.__target)
#
# self.__stub = self.__stub_type(channel)
self.__stub_update_time = datetime.datetime.now()
else:
pass
评论列表
文章目录