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) {