Commit 3c406e5b authored by Jiahang Chen's avatar Jiahang Chen
Browse files

add broker reconnection

parent a99cab13
Pipeline #455439 passed with stages
in 53 seconds
...@@ -232,9 +232,8 @@ def run_forever(self): ...@@ -232,9 +232,8 @@ def run_forever(self):
__log = "[S3I]: Launch {}".format(self.name) __log = "[S3I]: Launch {}".format(self.name)
APP_LOGGER.info(__log) APP_LOGGER.info(__log)
self.__connect_with_idp() self.__connect_with_idp()
self.__dir_syn()
threading.Thread(target=self.__json_syn).start() threading.Thread(target=self.__json_syn).start()
threading.Thread(target=self.__dir_syn).start()
if self.__is_repo: if self.__is_repo:
threading.Thread(target=self.__repo_syn).start() threading.Thread(target=self.__repo_syn).start()
...@@ -322,7 +321,6 @@ def __on_token(self, token): ...@@ -322,7 +321,6 @@ def __on_token(self, token):
:type token: str :type token: str
""" """
self.__access_token = token self.__access_token = token
self.__connect_with_dir() self.__connect_with_dir()
self.__connect_with_repo() self.__connect_with_repo()
...@@ -407,8 +405,9 @@ def receive(): ...@@ -407,8 +405,9 @@ def receive():
target=self.broker.receive, target=self.broker.receive,
args=(self.__endpoint, self.__on_broker_callback), args=(self.__endpoint, self.__on_broker_callback),
).start() ).start()
else: else:
self.broker.update_token(self.access_token) self.broker.maybe_reconnect(self.access_token)
def __on_broker_callback(self, ch, method, properties, body): def __on_broker_callback(self, ch, method, properties, body):
"""Parses body (content of a S3I-B message) and delegates the """Parses body (content of a S3I-B message) and delegates the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment