From 468f58b37308db911bc5ec7b0add4a8d56a7085e Mon Sep 17 00:00:00 2001 From: JGiter Date: Mon, 17 Jul 2023 08:20:58 +0300 Subject: [PATCH] refactor: resolve from ipfs with any --- src/modules/ipfs/ipfs.service.ts | 11 ++++------- tsconfig.json | 4 +++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/modules/ipfs/ipfs.service.ts b/src/modules/ipfs/ipfs.service.ts index 4080073b2..c05d30e74 100644 --- a/src/modules/ipfs/ipfs.service.ts +++ b/src/modules/ipfs/ipfs.service.ts @@ -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 }) diff --git a/tsconfig.json b/tsconfig.json index f13cb716a..64cec5efc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,9 @@ "resolveJsonModule": true, "moduleResolution": "node", "esModuleInterop": true, - "lib": ["ES2020"], + "lib": [ + "ES2021" + ], "noUnusedLocals": true, "skipLibCheck": true }