From 756cd1e14724064ad5cf597aa747e8d657d6ed5c Mon Sep 17 00:00:00 2001 From: Connor Barr Date: Wed, 28 Aug 2024 14:56:21 +0100 Subject: [PATCH] fix: altered orders cache to be more responsive --- .../server/src/queries/complex/orderbooks/active-orders.ts | 2 +- packages/web/hooks/limit-orders/use-orderbook.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/server/src/queries/complex/orderbooks/active-orders.ts b/packages/server/src/queries/complex/orderbooks/active-orders.ts index a42b0b9299..b6526bca08 100644 --- a/packages/server/src/queries/complex/orderbooks/active-orders.ts +++ b/packages/server/src/queries/complex/orderbooks/active-orders.ts @@ -27,7 +27,7 @@ export function getOrderbookActiveOrdersSQS({ return cachified({ cache: activeOrdersCache, key: `orderbookActiveOrders-sqs-${userOsmoAddress}`, - ttl: 5000, // 5 seconds + ttl: 1000, // 1 second getFreshValue: () => queryActiveOrdersSQS({ userOsmoAddress, diff --git a/packages/web/hooks/limit-orders/use-orderbook.ts b/packages/web/hooks/limit-orders/use-orderbook.ts index 687eb06afe..86f658e925 100644 --- a/packages/web/hooks/limit-orders/use-orderbook.ts +++ b/packages/web/hooks/limit-orders/use-orderbook.ts @@ -309,8 +309,8 @@ export const useOrderbookAllActiveOrders = ({ const refetchOrders = useCallback(async () => { if (isRefetching) return; - - return refetch(); + console.log("REFETCHING"); + await refetch(); }, [refetch, isRefetching]); return { @@ -356,8 +356,6 @@ export const useOrderbookClaimableOrders = ({ enabled: !!userAddress && addresses.length > 0 && !disabled, refetchOnMount: true, keepPreviousData: false, - cacheTime: refetchInterval, - staleTime: refetchInterval, trpc: { abortOnUnmount: true, context: {