Ver Fonte

query-node: fix some ApiPromise specific issues in index-builder

Mokhtar Naamani há 4 anos atrás
pai
commit
e952c9adc7

+ 1 - 0
query-node/.gitignore

@@ -0,0 +1 @@
+lib

+ 1 - 1
query-node/index-builder/src/node/QueryNode.ts

@@ -78,7 +78,7 @@ export class QueryNode {
     // Create the API and wait until ready
     const api = await retry(
       () =>
-        new ApiPromise({ provider, registry, types, typesSpec }).isReadyOrError,
+        new ApiPromise({ provider, registry, types, typesSpec }).isReady,
       SUBSTRATE_API_CALL_RETRIES
     )
 

+ 2 - 2
query-node/index-builder/src/substrate/SubstrateService.ts

@@ -101,8 +101,8 @@ export class SubstrateService implements ISubstrateService {
   }
 
   async stop(): Promise<void> {
-    if (this.api.isConnected) {
-      await this.api.disconnect()
+    if (this.api.isReady) {
+      this.api.disconnect()
     }
   }
 }

+ 1 - 1
query-node/package.json

@@ -3,7 +3,7 @@
 	"version": "1.0.0",
 	"description": "GraphQL server and Substrate indexer. Generated with ♥ by Hydra-CLI",
 	"scripts": {
-		"build": "tsc --build tsconfig.json",
+		"build": "yarn workspace @joystream/hydra-indexer-lib build && tsc --build tsconfig.json",
 		"test": "echo \"Error: no test specified\" && exit 1",
 		"clean": "rm -rf ./generated",
 		"processor:start": "(cd ./generated/indexer && yarn && DEBUG=${DEBUG} yarn start:processor)",