From 7f812c93b19fc456ac1ecd66510d403b8ff775c3 Mon Sep 17 00:00:00 2001 From: ChiouRung Haung Date: Wed, 9 Sep 2020 14:35:35 +0800 Subject: [PATCH] [xcvrd] Don't log unnecessary messages upon empty transceiver change event (#53) When port_dict of transceiver_change is empty, do nothing rather than log messages like ``` xcvrd: Got event True {} in state 1 xcvrd: mapping from True {'-1': 'system_become_ready'} to system_become_ready xcvrd: Got system_become_ready in normal state, ignored ``` --- sonic-xcvrd/scripts/xcvrd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic-xcvrd/scripts/xcvrd b/sonic-xcvrd/scripts/xcvrd index 3095ebe2a464..48f110a7317a 100644 --- a/sonic-xcvrd/scripts/xcvrd +++ b/sonic-xcvrd/scripts/xcvrd @@ -954,6 +954,8 @@ class SfpStateUpdateTask(object): next_state = state time_start = time.time() status, port_dict = _wrapper_get_transceiver_change_event(timeout) + if not port_dict: + continue helper_logger.log_debug("Got event {} {} in state {}".format(status, port_dict, state)) event = self._mapping_event_from_change_event(status, port_dict) if event == SYSTEM_NOT_READY: