Skip to content

Commit

Permalink
refactor: resolve from ipfs with any
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jul 17, 2023
1 parent ddabc53 commit 468f58b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/modules/ipfs/ipfs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,12 @@ export class IPFSService implements OnModuleDestroy {
const getFromCluster = this.didStoreCluster.get(cid);
const getFromInfura = this.didStoreInfura.get(cid);
try {
claim = await Promise.race([getFromCluster, getFromInfura]);
claim = await Promise.any([getFromCluster, getFromInfura]);
} catch (e) {
try {
claim = await getFromInfura;
} catch (e) {
// TODO: catch this in DidService
throw new HttpException(`Claim ${cid} not found`, HttpStatus.NOT_FOUND);
}
// TODO: catch this in DidService
throw new HttpException(`Claim ${cid} not found`, HttpStatus.NOT_FOUND);
}

await this.pinsQueue.add(
PIN_CLAIM_JOB_NAME,
JSON.stringify({ cid, claim })
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"resolveJsonModule": true,
"moduleResolution": "node",
"esModuleInterop": true,
"lib": ["ES2020"],
"lib": [
"ES2021"
],
"noUnusedLocals": true,
"skipLibCheck": true
}
Expand Down

0 comments on commit 468f58b

Please sign in to comment.