Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Aug 23, 2024
1 parent 082c86c commit f575531
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ const activeOrdersCache = new LRUCache<string, CacheEntry>(DEFAULT_LRU_OPTIONS);

export function getOrderbookActiveOrdersSQS({
userOsmoAddress,
chainList,
assetList,
}: {
userOsmoAddress: string;
chainList: Chain[];
assetList: AssetList[];
}) {
return cachified({
cache: activeOrdersCache,
key: `orderbookActiveOrders-sqs-${userOsmoAddress}`,
ttl: 10000, // 10 seconds
ttl: 5000, // 5 seconds
getFreshValue: () =>
queryActiveOrdersSQS({
userOsmoAddress,
Expand Down
26 changes: 14 additions & 12 deletions packages/trpc/src/orderbook-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,22 @@ export const orderbookRouter = createTRPCRouter({
return maybeCachePaginatedItems({
getFreshItems: async () => {
const { userOsmoAddress } = input;
const orders = await getOrderbookActiveOrdersSQS({
userOsmoAddress,
chainList: ctx.chainList,
assetList: ctx.assetLists,
});
const historicalOrders = await getOrderbookHistoricalOrders({
userOsmoAddress,
assetLists: ctx.assetLists,
chainList: ctx.chainList,
});
return [...orders, ...historicalOrders].sort(defaultSortOrders);
const promises = [
getOrderbookActiveOrdersSQS({
userOsmoAddress,
assetList: ctx.assetLists,
}),
getOrderbookHistoricalOrders({
userOsmoAddress,
assetLists: ctx.assetLists,
chainList: ctx.chainList,
}),
];
const orders = await Promise.all(promises);
return orders.flat().sort(defaultSortOrders);
},
cacheKey: `all-active-orders-sqs-${input.userOsmoAddress}`,
ttl: 2000,
ttl: 5000,
cursor: input.cursor,
limit: input.limit,
});
Expand Down

0 comments on commit f575531

Please sign in to comment.