From 4ec19e56a9e807ca0d62a92054b07aa1c080ef44 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sat, 15 Mar 2025 11:17:50 +0530 Subject: [PATCH] MINOR: fix test connection showing timeout even after being successfull (#20260) * fix test connection showing timeout even after being successfull * clear the timeout if the execution is being finished and reverted the last commit changes --- .../components/common/TestConnection/TestConnection.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/TestConnection/TestConnection.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/TestConnection/TestConnection.tsx index a3b6b8e9076..d5d866228bb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/TestConnection/TestConnection.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/TestConnection/TestConnection.tsx @@ -165,7 +165,7 @@ const TestConnection: FC = ({ setTestConnectionStepResult([]); setTestStatus(undefined); setIsConnectionTimeout(false); - setProgress(0); + setProgress(TEST_CONNECTION_PROGRESS_PERCENTAGE.ZERO); }; const handleDeleteWorkflow = async (workflowId: string) => { @@ -206,6 +206,7 @@ const TestConnection: FC = ({ response: Workflow, intervalObject: { intervalId?: number; + timeoutId?: number; } ) => { // return a promise that wraps the interval and handles errors inside it @@ -242,6 +243,7 @@ const TestConnection: FC = ({ // clear the current interval clearInterval(intervalObject.intervalId); + clearTimeout(intervalObject.timeoutId); // set testing connection to false setIsTestingConnection(false); @@ -269,6 +271,7 @@ const TestConnection: FC = ({ // current interval id const intervalObject: { intervalId?: number; + timeoutId?: number; } = {}; try { @@ -312,7 +315,7 @@ const TestConnection: FC = ({ } // stop fetching the workflow after 2 minutes - setTimeout(() => { + const timeoutId = setTimeout(() => { // clear the current interval clearInterval(intervalObject.intervalId); @@ -333,6 +336,8 @@ const TestConnection: FC = ({ setProgress(TEST_CONNECTION_PROGRESS_PERCENTAGE.HUNDRED); }, FETCHING_EXPIRY_TIME); + intervalObject.timeoutId = Number(timeoutId); + // Handle workflow polling and completion await handleWorkflowPolling(response, intervalObject); } catch (error) {