This is an automated email from the ASF dual-hosted git repository.

justinpark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e1ef193dd fix(sqllab): Add abort call on query refresh timeout 
(#29956)
6e1ef193dd is described below

commit 6e1ef193dd788e6847b77c4b725868aafb0b928f
Author: JUST.in DO IT <[email protected]>
AuthorDate: Sat Aug 17 06:59:57 2024 +0900

    fix(sqllab): Add abort call on query refresh timeout (#29956)
---
 .../src/SqlLab/components/QueryAutoRefresh/index.tsx    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx 
b/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
index f4808f52fd..0c5f550549 100644
--- a/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
+++ b/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
@@ -76,28 +76,35 @@ function QueryAutoRefresh({
         last_updated_ms: queriesLastUpdate - QUERY_UPDATE_BUFFER_MS,
       });
 
+      const controller = new AbortController();
       pendingRequestRef.current = true;
       SupersetClient.get({
         endpoint: `/api/v1/query/updated_since?q=${params}`,
         timeout: QUERY_TIMEOUT_LIMIT,
         parseMethod: 'json-bigint',
+        signal: controller.signal,
       })
         .then(({ json }) => {
           if (json) {
             const jsonPayload = json as { result?: QueryResponse[] };
             if (jsonPayload?.result?.length) {
               const queries =
-                jsonPayload?.result?.reduce((acc, current) => {
-                  acc[current.id] = current;
-                  return acc;
-                }, {}) ?? {};
+                jsonPayload?.result?.reduce(
+                  (acc: Record<string, QueryResponse>, current) => {
+                    acc[current.id] = current;
+                    return acc;
+                  },
+                  {},
+                ) ?? {};
               dispatch(refreshQueries(queries));
             } else {
               dispatch(clearInactiveQueries(QUERY_UPDATE_FREQ));
             }
           }
         })
-        .catch(() => {})
+        .catch(() => {
+          controller.abort();
+        })
         .finally(() => {
           pendingRequestRef.current = false;
         });

Reply via email to