From a4fa79ada7ac60271982539a74de0851ed3a5f1a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 23 Dec 2024 15:00:06 +0000 Subject: [PATCH] avoid breaking if an inflows api failsg --- src/pages/cexs/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/cexs/index.tsx b/src/pages/cexs/index.tsx index 6563fbe91..f5c4c2eea 100644 --- a/src/pages/cexs/index.tsx +++ b/src/pages/cexs/index.tsx @@ -666,7 +666,7 @@ export const getStaticProps = withPerformanceLogging('cexs/index', async () => { if (c.slug === undefined) { return c } else { - const res = await Promise.all([ + const res = await Promise.allSettled([ fetch(`https://api.llama.fi/updatedProtocol/${c.slug}`).then((r) => r.json()), fetch(`https://api.llama.fi/inflows/${c.slug}/${hour24ms}?tokensToExclude=${c.coin ?? ''}`).then((r) => r.json() @@ -682,7 +682,7 @@ export const getStaticProps = withPerformanceLogging('cexs/index', async () => { return c } - const [{ chainTvls = {} }, inflows24h, inflows7d, inflows1m] = res + const [{ chainTvls = {} }, inflows24h, inflows7d, inflows1m] = res.map((p) => p.value) let cexTvl = 0