From 905b403ead2c7d4b4be860217a35fd87c7cc7ed7 Mon Sep 17 00:00:00 2001 From: junchao Date: Tue, 18 Jan 2022 17:59:40 +0800 Subject: [PATCH 1/2] [Mellanox] Fix select timeout in sfp event --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py index 669c49db8131..bd0d3d836f32 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py @@ -257,7 +257,7 @@ def check_sfp_status(self, port_change, error_dict, timeout): found = 0 try: - read, _, _ = select.select([self.rx_fd_p.fd], [], [], timeout) + read, _, _ = select.select([self.rx_fd_p.fd], [], [], timeout / 1000) print(read) except select.error as err: rc, msg = err From 8aafeeac8d2640479ee0e63ecb28605246b7a05a Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Thu, 20 Jan 2022 09:33:25 +0800 Subject: [PATCH 2/2] Fix LGTM issue --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py index bd0d3d836f32..519d038ff326 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp_event.py @@ -257,7 +257,7 @@ def check_sfp_status(self, port_change, error_dict, timeout): found = 0 try: - read, _, _ = select.select([self.rx_fd_p.fd], [], [], timeout / 1000) + read, _, _ = select.select([self.rx_fd_p.fd], [], [], float(timeout) / 1000) print(read) except select.error as err: rc, msg = err