From 2b6e537f4e2a06603cfb62c61a2af5f471b4a699 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 13 Dec 2024 15:19:37 +0000 Subject: [PATCH 1/3] make retries and interval bigger & configurable --- src/services/Aquarius.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/Aquarius.ts b/src/services/Aquarius.ts index 426715ae4..3e4357572 100644 --- a/src/services/Aquarius.ts +++ b/src/services/Aquarius.ts @@ -59,7 +59,9 @@ export class Aquarius { public async waitForAqua( did: string, txid?: string, - signal?: AbortSignal + signal?: AbortSignal, + interval: number = 3000, + maxRetries: number = 100 ): Promise { let tries = 0 do { @@ -80,9 +82,9 @@ export class Aquarius { } catch (e) { // do nothing } - await sleep(1500) + await sleep(interval) tries++ - } while (tries < 100) + } while (tries < maxRetries) return null } From 6381795c957f301b93461d84a14ff59991b58738 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Fri, 13 Dec 2024 17:19:39 +0000 Subject: [PATCH 2/3] rename waitForAqua as waitForIndexer --- CodeExamples.md | 4 ++-- ComputeExamples.md | 4 ++-- docs/classes/Aquarius.md | 10 ++++++---- src/services/Aquarius.ts | 4 ++-- test/integration/CodeExamples.test.ts | 4 ++-- test/integration/ComputeExamples.test.ts | 4 ++-- test/integration/ComputeFlow.test.ts | 8 ++++---- test/integration/PublishEditConsume.test.ts | 18 +++++++++--------- test/integration/PublishFlows.test.ts | 4 ++-- 9 files changed, 31 insertions(+), 29 deletions(-) diff --git a/CodeExamples.md b/CodeExamples.md index c9184b6e1..ef020a78d 100644 --- a/CodeExamples.md +++ b/CodeExamples.md @@ -504,7 +504,7 @@ Now we can make the contract call ) console.log(`Consumer ${FRE_NFT_SYMBOL} balance after swap: ${consumerDTBalance}`) - const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id) + const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id) assert(resolvedDDO, 'Cannot fetch DDO from Aquarius') ``` @@ -726,7 +726,7 @@ Now we need to encrypt file(s) using provider `Consumer ${DISP_NFT_SYMBOL} balance after dispense: ${consumerDTBalance}` ) - const resolvedDDO = await aquarius.waitForAqua(fixedDDO.id) + const resolvedDDO = await aquarius.waitForIndexer(fixedDDO.id) assert(resolvedDDO, 'Cannot fetch DDO from Aquarius') datatoken = new Datatoken(consumerAccount, await consumerAccount.getChainId()) diff --git a/ComputeExamples.md b/ComputeExamples.md index 41f5c618b..19c6bae74 100644 --- a/ComputeExamples.md +++ b/ComputeExamples.md @@ -539,8 +539,8 @@ Now, let's check that we successfully published a algorithm (create NFT + Datato ### 7.1 Resolve published datasets and algorithms ```Typescript - resolvedDatasetDdo = await aquariusInstance.waitForAqua(datasetId) - resolvedAlgorithmDdo = await aquariusInstance.waitForAqua(algorithmId) + resolvedDatasetDdo = await aquariusInstance.waitForIndexer(datasetId) + resolvedAlgorithmDdo = await aquariusInstance.waitForIndexer(algorithmId) ```