bbovenzi commented on code in PR #56163:
URL: https://github.com/apache/airflow/pull/56163#discussion_r2389008292
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx:
##########
@@ -17,25 +17,42 @@
* under the License.
*/
import { Box, Heading, Flex, Skeleton, Link } from "@chakra-ui/react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
import { BiTargetLock } from "react-icons/bi";
import { Link as RouterLink } from "react-router-dom";
import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
import { usePoolServiceGetPools } from "openapi/queries/queries";
+import type { ExpandedApiError } from "src/components/ErrorAlert";
+import { ErrorAlert } from "src/components/ErrorAlert";
import { PoolBar } from "src/components/PoolBar";
import { useAutoRefresh } from "src/utils";
import { type Slots, slotKeys } from "src/utils/slots";
export const PoolSummary = () => {
const { t: translate } = useTranslation("dashboard");
const refetchInterval = useAutoRefresh({});
- const { data, isLoading } = usePoolServiceGetPools(undefined, undefined, {
- refetchInterval,
- });
+
const { data: authLinks } = useAuthLinksServiceGetAuthMenus();
const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
+ const [hasPermissionError, setHasPermissionError] = useState(false);
+
+ const { data, error, isLoading } = usePoolServiceGetPools(undefined,
undefined, {
+ enabled: !hasPermissionError,
+ refetchInterval: hasPermissionError ? false : refetchInterval,
+ retry: (failureCount, retryError) => {
+ if (Boolean(retryError) && (retryError as ExpandedApiError).status ===
403) {
+ setHasPermissionError(true);
+
+ return false;
+ }
+
+ return failureCount < 3;
+ },
+ });
+
Review Comment:
Instead of state, I think we should just check if the error is a 403 and
return undefined. No need to track state and mess with the retry number. I have
a separate draft PR to fix the refetchInterval from firing incessantly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]