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

pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 04b56eb361b [v3-1-test] Improve UI retry strategy on client errors 
(#56625) (#56638)
04b56eb361b is described below

commit 04b56eb361b52f38067f5ff478a3883b2bfe7770
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Oct 15 18:12:35 2025 +0200

    [v3-1-test] Improve UI retry strategy on client errors (#56625) (#56638)
    
    (cherry picked from commit 7939692b266a20b340f133f998612f083c585b6c)
    
    Co-authored-by: Pierre Jeambrun <[email protected]>
---
 airflow-core/src/airflow/ui/src/queryClient.ts | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/airflow-core/src/airflow/ui/src/queryClient.ts 
b/airflow-core/src/airflow/ui/src/queryClient.ts
index b3147032ace..7ebc52c55d5 100644
--- a/airflow-core/src/airflow/ui/src/queryClient.ts
+++ b/airflow-core/src/airflow/ui/src/queryClient.ts
@@ -26,16 +26,29 @@ if (OpenAPI.BASE.endsWith("/")) {
   OpenAPI.BASE = OpenAPI.BASE.slice(0, -1);
 }
 
+const RETRY_COUNT = 3;
+
+const retryFunction = (failureCount: number, error: unknown) => {
+  const { status } = error as { status?: number };
+
+  // Do not retry for client errors (4xx). 429 should be eventually retried 
though.
+  if (status !== undefined && status >= 400 && status < 500 && status !== 429) 
{
+    return false;
+  }
+
+  return failureCount < RETRY_COUNT;
+};
+
 export const client = new QueryClient({
   defaultOptions: {
     mutations: {
-      retry: 3,
+      retry: retryFunction,
     },
     queries: {
       initialDataUpdatedAt: new Date().setMinutes(-6), // make sure initial 
data is already expired
       refetchOnMount: true, // Refetches stale queries, not "always"
       refetchOnWindowFocus: false,
-      retry: 3,
+      retry: retryFunction,
       staleTime: 5 * 60 * 1000, // 5 minutes
     },
   },

Reply via email to