Skip to content

Commit

Permalink
fix: remove unneded IPFS request catch
Browse files Browse the repository at this point in the history
  • Loading branch information
boudra committed Sep 20, 2023
1 parent 830f21d commit b23dcd7
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/index.ts
Expand Up @@ -194,28 +194,25 @@ async function catchupAndWatchChain(

chainLogger.trace(`Fetching ${url}`);

try {
const res = await fetch(url, {
timeout: 2000,
onRetry(cause) {
chainLogger.debug(`Retrying IPFS request ${String(cause)}`);
},
retry: { retries: 3, minTimeout: 2000, maxTimeout: 60 * 10000 },
// IPFS data is immutable, we can rely entirely on the cache when present
cache: "force-cache",
cachePath:
config.cacheDir !== null
? path.join(config.cacheDir, "ipfs")
: undefined,
});

return (await res.json()) as T;
} catch (err) {
chainLogger.warn({
msg: "failed to load IPFS file",
err,
});
}
const res = await fetch(url, {
timeout: 2000,
onRetry(cause) {
chainLogger.debug({
msg: "Retrying IPFS request",
url: url,
err: cause,
});
},
retry: { retries: 3, minTimeout: 2000, maxTimeout: 60 * 10000 },
// IPFS data is immutable, we can rely entirely on the cache when present
cache: "force-cache",
cachePath:
config.cacheDir !== null
? path.join(config.cacheDir, "ipfs")
: undefined,
});

return (await res.json()) as T;
};

await rpcProvider.getNetwork();
Expand Down

0 comments on commit b23dcd7

Please sign in to comment.