Skip to content

Commit 8261ef0

Browse files
committed
Merge branch '3.5.x'
2 parents 388830c + bfd8973 commit 8261ef0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

framework/fit/python/plugin/fit_py_heart_beat_agent/heart_beat_agent.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def _try_heart_beat_once():
9494
f"heart_beat_gap={'{:.3f}'.format(heart_beat_gap)}s, "
9595
f"heart_beat_interval={'{:.3f}'.format(_interval() / 1000)}s]")
9696
if _FAIL_COUNT != 0:
97+
_registry_fitable_addresses()
9798
sys_plugin_logger.info(f"heart beat reconnect success. [fail_count={_FAIL_COUNT}]")
9899
_FAIL_COUNT = 0
99100
sys_plugin_logger.debug(f'heart beating success.')
@@ -155,3 +156,24 @@ def offline():
155156
@fitable(const.HEART_BEAT_EXIT_UNEXPECTEDLY_GEN_ID, const.HEART_BEAT_EXIT_UNEXPECTEDLY_FIT_ID)
156157
def heart_beat_exit_unexpectedly() -> bool:
157158
return _HEART_BEAT_EXIT_UNEXPECTEDLY
159+
160+
161+
@fit(const.SERVICE_DB_REGISTER_ALL_FIT_SERVICE_GEN_ID)
162+
def register_all_fit_services() -> None:
163+
pass
164+
165+
166+
def _registry_fitable_addresses():
167+
"""
168+
Register with the registration center after the heartbeat is reconnected.
169+
"""
170+
try:
171+
register_all_fit_services()
172+
sys_plugin_logger.info("In heart beat agent registry all fitable address success.")
173+
except:
174+
sys_plugin_logger.warning(f"In heart beat agent registry all fitable address failed.")
175+
except_type, except_value, except_traceback = sys.exc_info()
176+
sys_plugin_logger.warning(f"In heart beat agent registry all fitable address error type: {except_type}")
177+
sys_plugin_logger.warning(f"In heart beat agent registry all fitable address error value: {except_value}")
178+
sys_plugin_logger.warning(f"In heart beat agent registry all fitable address error trace back:\n"
179+
f"{''.join(traceback.format_tb(except_traceback))}")

0 commit comments

Comments
 (0)