From 6fe2c92cee1f1fb4a49e294b99b7b7ebe1a4f52e Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Tue, 13 Sep 2022 15:16:01 -0700 Subject: [PATCH] fix: reduce price fetching to every 2m (#4622) * fix: reduce price fetching to every 2m * fix: grammar --- src/state/routing/useRoutingAPITrade.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/state/routing/useRoutingAPITrade.ts b/src/state/routing/useRoutingAPITrade.ts index 5b1482e715..34e8ed2fa7 100644 --- a/src/state/routing/useRoutingAPITrade.ts +++ b/src/state/routing/useRoutingAPITrade.ts @@ -44,7 +44,8 @@ export function useRoutingAPITrade( }) const { isLoading, isError, data, currentData } = useGetQuoteQuery(queryArgs ?? skipToken, { - pollingInterval: ms`15s`, + // Price-fetching is informational and costly, so it's done less frequently. + pollingInterval: routerPreference === RouterPreference.PRICE ? ms`2m` : ms`15s`, }) const quoteResult: GetQuoteResult | undefined = useIsValidBlock(Number(data?.blockNumber) || 0) ? data : undefined