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
This commit is contained in:
Ashish Gupta 2025-03-15 11:17:50 +05:30 committed by GitHub
parent 153358a216
commit 4ec19e56a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,7 +165,7 @@ const TestConnection: FC<TestConnectionProps> = ({
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<TestConnectionProps> = ({
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<TestConnectionProps> = ({
// clear the current interval
clearInterval(intervalObject.intervalId);
clearTimeout(intervalObject.timeoutId);
// set testing connection to false
setIsTestingConnection(false);
@ -269,6 +271,7 @@ const TestConnection: FC<TestConnectionProps> = ({
// current interval id
const intervalObject: {
intervalId?: number;
timeoutId?: number;
} = {};
try {
@ -312,7 +315,7 @@ const TestConnection: FC<TestConnectionProps> = ({
}
// 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<TestConnectionProps> = ({
setProgress(TEST_CONNECTION_PROGRESS_PERCENTAGE.HUNDRED);
}, FETCHING_EXPIRY_TIME);
intervalObject.timeoutId = Number(timeoutId);
// Handle workflow polling and completion
await handleWorkflowPolling(response, intervalObject);
} catch (error) {