bbovenzi commented on code in PR #70667:
URL: https://github.com/apache/airflow/pull/70667#discussion_r3713696682
##########
airflow-core/src/airflow/ui/src/queries/useDags.tsx:
##########
@@ -80,14 +80,7 @@ export const useDags = ({
teams,
},
undefined,
- {
- refetchInterval: (query) =>
- query.state.data?.dags.some(
- (dag) => !dag.is_paused && dag.latest_dag_runs.some((dr) =>
isStatePending(dr.state)),
- )
- ? refetchInterval
- : false,
- },
+ { refetchInterval },
Review Comment:
The dags list UI is not a lightweight endpoint so we shouldn't constantly
refretch it at the same interval.
Instead of turning off the refresh with passing `false` we could back off
with a `refetchInterval * 10`
##########
airflow-core/src/airflow/ui/src/queries/useDagRunStateCounts.tsx:
##########
@@ -17,29 +17,19 @@
* under the License.
*/
import { useDagServiceGetDagRunStateCountsUi } from "openapi/queries";
-import type { DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
-import { isStatePending, useAutoRefresh } from "src/utils";
+import { useAutoRefresh } from "src/utils";
-export const useDagRunStateCounts = ({
- dagIds,
- dags,
-}: {
- readonly dagIds: ReadonlyArray<string>;
- // Refresh predicate is derived from useDags' data so the counts query
doesn't
- // need to be loaded before it knows whether to poll — avoids a
chicken-and-egg.
- readonly dags: ReadonlyArray<DAGWithLatestDagRunsResponse> | undefined;
-}) => {
- const refetchInterval = useAutoRefresh({});
- const hasPendingRun =
- dags?.some((dag) => !dag.is_paused && dag.latest_dag_runs.some((run) =>
isStatePending(run.state))) ??
- false;
+export const useDagRunStateCounts = ({ dagIds }: { readonly dagIds:
ReadonlyArray<string> }) => {
+ // checkPendingRuns: true checks for pending runs across *all* dags and
scales the interval back
+ // rather than disabling polling outright once the currently displayed page
has nothing pending.
Review Comment:
We don't need this description
--
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]