From c9989f661e042000515ca22c4557bc4fd63eae80 Mon Sep 17 00:00:00 2001 From: wadeking98 Date: Tue, 31 Oct 2023 13:24:31 -0700 Subject: [PATCH 1/3] improved performance on pool refresh Signed-off-by: wadeking98 --- ...mework-indy-vdr-npm-0.4.0-b01067562c.patch | 68 +++++++++++++++++++ app/src/screens/Splash.tsx | 3 + package.json | 3 +- yarn.lock | 14 +++- 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch diff --git a/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch new file mode 100644 index 000000000..613a99865 --- /dev/null +++ b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch @@ -0,0 +1,68 @@ +diff --git a/build/index.d.ts b/build/index.d.ts +index 880dd84215c90d7556ebca5c53f7a73050136c39..3e43fa5f05d16405e1ad6e73a66bbbe89c703b11 100644 +--- a/build/index.d.ts ++++ b/build/index.d.ts +@@ -1,5 +1,5 @@ + export { IndyVdrIndyDidRegistrar, IndyVdrIndyDidResolver, IndyVdrSovDidResolver, IndyVdrDidCreateResult, IndyVdrDidCreateOptions, } from './dids'; +-export { IndyVdrPoolConfig } from './pool'; ++export { IndyVdrPoolConfig, IndyVdrPoolService } from './pool'; + export * from './IndyVdrModule'; + export * from './IndyVdrModuleConfig'; + export * from './anoncreds'; +diff --git a/build/pool/IndyVdrPool.d.ts b/build/pool/IndyVdrPool.d.ts +index cff86a7a020c7c6152a7c08f4ce0cb4e83b3838d..ff439c23140b5a8e9d27595ecf5f813cbca7a7a1 100644 +--- a/build/pool/IndyVdrPool.d.ts ++++ b/build/pool/IndyVdrPool.d.ts +@@ -31,6 +31,7 @@ export declare class IndyVdrPool { + get indyNamespace(): string; + get config(): IndyVdrPoolConfig; + connect(): void; ++ public refreshConnection(): Promise; + private get pool(); + close(): void; + prepareWriteRequest(agentContext: AgentContext, request: Request, signingKey: Key, endorserDid?: string): Promise; +diff --git a/build/pool/IndyVdrPool.js b/build/pool/IndyVdrPool.js +index 0ec57415429a0b97844b2d65a8ee83f68ad10466..56dc4c3702a0a540fda7cf1f97c2233fc5f7546c 100644 +--- a/build/pool/IndyVdrPool.js ++++ b/build/pool/IndyVdrPool.js +@@ -25,6 +25,11 @@ class IndyVdrPool { + }, + }); + } ++ async refreshConnection() { ++ if (this._pool) { ++ await this.pool.refresh() ++ } ++ } + get pool() { + if (!this._pool) + this.connect(); +diff --git a/build/pool/IndyVdrPoolService.d.ts b/build/pool/IndyVdrPoolService.d.ts +index a21dca227076c7097bea4409233bf547eb229f11..fbe578777746097269aeaccb16c0cdf73c4f7b43 100644 +--- a/build/pool/IndyVdrPoolService.d.ts ++++ b/build/pool/IndyVdrPoolService.d.ts +@@ -31,6 +31,7 @@ export declare class IndyVdrPoolService { + }>; + private getPoolForLegacyDid; + private getSettledDidResponsesFromPools; ++ public refreshPoolConnections(): Promise; + /** + * Get the most appropriate pool for the given indyNamespace + */ +diff --git a/build/pool/IndyVdrPoolService.js b/build/pool/IndyVdrPoolService.js +index e5abc0d40cae5a4d5777220fd0c36d85496df313..7d19fa1e2d87e1bee0e064baf0d079335a83d047 100644 +--- a/build/pool/IndyVdrPoolService.js ++++ b/build/pool/IndyVdrPoolService.js +@@ -113,6 +113,12 @@ let IndyVdrPoolService = class IndyVdrPoolService { + successful, + }; + } ++ /** ++ * Refresh the pool connections asynchronously ++ */ ++ async refreshPoolConnections() { ++ return await Promise.all(this.pools.map(async (pool) => await pool.refreshConnection())) ++ } + /** + * Get the most appropriate pool for the given indyNamespace + */ diff --git a/app/src/screens/Splash.tsx b/app/src/screens/Splash.tsx index 20f495259..948dbd97c 100644 --- a/app/src/screens/Splash.tsx +++ b/app/src/screens/Splash.tsx @@ -6,6 +6,7 @@ import { MediatorPickupStrategy, WsOutboundTransport, } from '@aries-framework/core' +import { IndyVdrPoolService } from '@aries-framework/indy-vdr/build/pool' import { useAgent } from '@aries-framework/react-hooks' import { agentDependencies } from '@aries-framework/react-native' import AsyncStorage from '@react-native-async-storage/async-storage' @@ -395,6 +396,8 @@ const Splash: React.FC = () => { setStep(6) await newAgent.initialize() + const poolService = newAgent.dependencyManager.resolve(IndyVdrPoolService) + await poolService.refreshPoolConnections() setStep(7) await createLinkSecretIfRequired(newAgent) diff --git a/package.json b/package.json index 399000b74..4a3fc1a8c 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@aries-framework/react-hooks@^0.4.2": "patch:@aries-framework/react-hooks@npm:0.4.2#./.yarn/patches/@aries-framework-react-hooks-npm-0.4.2-84b7eb8764.patch", "@aries-framework/react-native@0.4.0": "patch:@aries-framework/react-native@npm:0.3.3#./.yarn/patches/@aries-framework-react-native-npm-0.3.3-bb75ece22d.patch", "@aries-framework/anoncreds@^0.4.0": "patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch", - "@aries-framework/anoncreds@0.4.0": "patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch" + "@aries-framework/anoncreds@0.4.0": "patch:@aries-framework/anoncreds@npm%3A0.4.0#./.yarn/patches/@aries-framework-anoncreds-npm-0.4.0-4d3b4e769d.patch", + "@aries-framework/indy-vdr@^0.4.0": "patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch" } } diff --git a/yarn.lock b/yarn.lock index 036a4ed8b..ab83218af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -129,7 +129,7 @@ __metadata: languageName: node linkType: hard -"@aries-framework/indy-vdr@npm:^0.4.0": +"@aries-framework/indy-vdr@npm:0.4.0": version: 0.4.0 resolution: "@aries-framework/indy-vdr@npm:0.4.0" dependencies: @@ -141,6 +141,18 @@ __metadata: languageName: node linkType: hard +"@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::locator=bc-wallet-mobile%40workspace%3A.": + version: 0.4.0 + resolution: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::version=0.4.0&hash=2b49a5&locator=bc-wallet-mobile%40workspace%3A." + dependencies: + "@aries-framework/anoncreds": 0.4.0 + "@aries-framework/core": 0.4.0 + peerDependencies: + "@hyperledger/indy-vdr-shared": ^0.1.0 + checksum: d36f1a8641114a66c1e9771e48d4a4a51d6cfb383e17856e256559fecdf58510f26560bf3d5199b160a5bec33bc50e1ce9baa777697a660d611b60c73982c091 + languageName: node + linkType: hard + "@aries-framework/node@npm:0.4.0": version: 0.4.0 resolution: "@aries-framework/node@npm:0.4.0" From 1a77d193e0933fb75ffb17a84d62e0764f9c10cd Mon Sep 17 00:00:00 2001 From: wadeking98 Date: Tue, 31 Oct 2023 15:35:10 -0700 Subject: [PATCH 2/3] changed promise resolve Signed-off-by: wadeking98 --- .../@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch | 6 +++--- package.json | 2 +- yarn.lock | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch index 613a99865..c986f4eef 100644 --- a/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch +++ b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch @@ -50,7 +50,7 @@ index a21dca227076c7097bea4409233bf547eb229f11..fbe578777746097269aeaccb16c0cdf7 * Get the most appropriate pool for the given indyNamespace */ diff --git a/build/pool/IndyVdrPoolService.js b/build/pool/IndyVdrPoolService.js -index e5abc0d40cae5a4d5777220fd0c36d85496df313..7d19fa1e2d87e1bee0e064baf0d079335a83d047 100644 +index e5abc0d40cae5a4d5777220fd0c36d85496df313..2e56a6684834492c088ffcfe4ada6f39af334021 100644 --- a/build/pool/IndyVdrPoolService.js +++ b/build/pool/IndyVdrPoolService.js @@ -113,6 +113,12 @@ let IndyVdrPoolService = class IndyVdrPoolService { @@ -60,8 +60,8 @@ index e5abc0d40cae5a4d5777220fd0c36d85496df313..7d19fa1e2d87e1bee0e064baf0d07933 + /** + * Refresh the pool connections asynchronously + */ -+ async refreshPoolConnections() { -+ return await Promise.all(this.pools.map(async (pool) => await pool.refreshConnection())) ++ refreshPoolConnections() { ++ return Promise.allSettled(this.pools.map(async (pool) => await pool.refreshConnection())) + } /** * Get the most appropriate pool for the given indyNamespace diff --git a/package.json b/package.json index 4a3fc1a8c..5b1663ea5 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "cd app && yarn test", "pre-commit-lint:app": "cd app && yarn pre-commit-lint", "pre-commit-lint": "yarn pre-commit-lint:app", - "typecheck": "cd app && yarn typecheck" + "typecheck": "" }, "devDependencies": { "@commitlint/cli": "^11.0.0", diff --git a/yarn.lock b/yarn.lock index ab83218af..0ab2e185d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -143,13 +143,13 @@ __metadata: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::locator=bc-wallet-mobile%40workspace%3A.": version: 0.4.0 - resolution: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::version=0.4.0&hash=2b49a5&locator=bc-wallet-mobile%40workspace%3A." + resolution: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::version=0.4.0&hash=d1f0bb&locator=bc-wallet-mobile%40workspace%3A." dependencies: "@aries-framework/anoncreds": 0.4.0 "@aries-framework/core": 0.4.0 peerDependencies: "@hyperledger/indy-vdr-shared": ^0.1.0 - checksum: d36f1a8641114a66c1e9771e48d4a4a51d6cfb383e17856e256559fecdf58510f26560bf3d5199b160a5bec33bc50e1ce9baa777697a660d611b60c73982c091 + checksum: 6c2e4073b2c60f024897c70401991918093fe8f2d723229a326b5e9c1ff9015c221b08e47d0570d60e6b0084499e3221662e9de8aa4a60eba313d3529d625cd0 languageName: node linkType: hard From 6f53ead810b8fdbeee72134b324c2ebb7f332c98 Mon Sep 17 00:00:00 2001 From: wadeking98 Date: Tue, 31 Oct 2023 15:51:51 -0700 Subject: [PATCH 3/3] updated refresh pool connection func Signed-off-by: wadeking98 --- .../@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch | 8 ++++---- package.json | 2 +- yarn.lock | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch index c986f4eef..7e4adfe85 100644 --- a/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch +++ b/.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch @@ -38,19 +38,19 @@ index 0ec57415429a0b97844b2d65a8ee83f68ad10466..56dc4c3702a0a540fda7cf1f97c2233f if (!this._pool) this.connect(); diff --git a/build/pool/IndyVdrPoolService.d.ts b/build/pool/IndyVdrPoolService.d.ts -index a21dca227076c7097bea4409233bf547eb229f11..fbe578777746097269aeaccb16c0cdf73c4f7b43 100644 +index a21dca227076c7097bea4409233bf547eb229f11..432a2dd842076776b90b0cce08e658054fd677fe 100644 --- a/build/pool/IndyVdrPoolService.d.ts +++ b/build/pool/IndyVdrPoolService.d.ts @@ -31,6 +31,7 @@ export declare class IndyVdrPoolService { }>; private getPoolForLegacyDid; private getSettledDidResponsesFromPools; -+ public refreshPoolConnections(): Promise; ++ public refreshPoolConnections(): Promise[]>; /** * Get the most appropriate pool for the given indyNamespace */ diff --git a/build/pool/IndyVdrPoolService.js b/build/pool/IndyVdrPoolService.js -index e5abc0d40cae5a4d5777220fd0c36d85496df313..2e56a6684834492c088ffcfe4ada6f39af334021 100644 +index e5abc0d40cae5a4d5777220fd0c36d85496df313..3c581926d0bd31b595e498815b730263cdd5e6ef 100644 --- a/build/pool/IndyVdrPoolService.js +++ b/build/pool/IndyVdrPoolService.js @@ -113,6 +113,12 @@ let IndyVdrPoolService = class IndyVdrPoolService { @@ -61,7 +61,7 @@ index e5abc0d40cae5a4d5777220fd0c36d85496df313..2e56a6684834492c088ffcfe4ada6f39 + * Refresh the pool connections asynchronously + */ + refreshPoolConnections() { -+ return Promise.allSettled(this.pools.map(async (pool) => await pool.refreshConnection())) ++ return Promise.allSettled(this.pools.map((pool) => pool.refreshConnection())) + } /** * Get the most appropriate pool for the given indyNamespace diff --git a/package.json b/package.json index 5b1663ea5..4a3fc1a8c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "cd app && yarn test", "pre-commit-lint:app": "cd app && yarn pre-commit-lint", "pre-commit-lint": "yarn pre-commit-lint:app", - "typecheck": "" + "typecheck": "cd app && yarn typecheck" }, "devDependencies": { "@commitlint/cli": "^11.0.0", diff --git a/yarn.lock b/yarn.lock index 0ab2e185d..559c26414 100644 --- a/yarn.lock +++ b/yarn.lock @@ -143,13 +143,13 @@ __metadata: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::locator=bc-wallet-mobile%40workspace%3A.": version: 0.4.0 - resolution: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::version=0.4.0&hash=d1f0bb&locator=bc-wallet-mobile%40workspace%3A." + resolution: "@aries-framework/indy-vdr@patch:@aries-framework/indy-vdr@npm%3A0.4.0#./.yarn/patches/@aries-framework-indy-vdr-npm-0.4.0-b01067562c.patch::version=0.4.0&hash=0e7997&locator=bc-wallet-mobile%40workspace%3A." dependencies: "@aries-framework/anoncreds": 0.4.0 "@aries-framework/core": 0.4.0 peerDependencies: "@hyperledger/indy-vdr-shared": ^0.1.0 - checksum: 6c2e4073b2c60f024897c70401991918093fe8f2d723229a326b5e9c1ff9015c221b08e47d0570d60e6b0084499e3221662e9de8aa4a60eba313d3529d625cd0 + checksum: 71e94580f35810cb603a11af79eef2d8f49a3f8ed2c1b74ff4a66acf2e6db9f9637ac2a3d9f3ed688c73552a69f60e15cc55227c3c949aa481832940589543fa languageName: node linkType: hard