Skip to content

Commit

Permalink
avoid breaking if an inflows api failsg
Browse files Browse the repository at this point in the history
  • Loading branch information
0xngmi committed Dec 23, 2024
1 parent 869f473 commit a4fa79a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/cexs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down

0 comments on commit a4fa79a

Please sign in to comment.