Skip to content

Commit

Permalink
Update cron-cache-gas-costs.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Jan 14, 2025
1 parent 59a8c98 commit 4b3c737
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/cron-cache-gas-costs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,24 @@ const handler = async (
// But we want to update gas data more frequently than that.
// To circumvent this, we run the function in a loop and update gas prices every
// `secondsPerUpdateForChain` seconds and stop after `maxDurationSec` seconds (1 minute).
const cacheUpdatePromises = Promise.all([
const cacheUpdatePromises = Promise.all(
mainnetChains.map(async (chain) => {
const routesToChain = availableRoutes.filter(
({ destinationChainId }) => destinationChainId === chain.chainId
);
const outputTokensForChain = routesToChain.map(
({ destinationToken }) => destinationToken
);
await Promise.all([
return Promise.all([
...outputTokensForChain.map((outputToken) =>
updateNativeGasCostPromise(chain.chainId, outputToken)
),
...outputTokensForChain.map((outputToken) =>
updateL1DataFeePromise(chain.chainId, outputToken)
),
]);
}),
]);
})
);

// The above promises are supposed to complete after maxDurationSec seconds, but there are so many of them
// (one per route) that they last one can run quite a bit longer, so force the function to stop after maxDurationSec
Expand Down

0 comments on commit 4b3c737

Please sign in to comment.