From 915edda07980cf8a232a1c8d4c00805144e1f81f Mon Sep 17 00:00:00 2001 From: Jianrong Date: Wed, 6 Dec 2023 13:06:40 +1100 Subject: [PATCH] fix small bug related to xdc-zero --- src/processors/standard.ts | 3 +-- src/processors/zero.ts | 4 +++- src/service/mainnet/extensions.ts | 2 +- src/service/subnet/extensions.ts | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/processors/standard.ts b/src/processors/standard.ts index 729d339..d7b2f95 100644 --- a/src/processors/standard.ts +++ b/src/processors/standard.ts @@ -72,7 +72,7 @@ export class Standard implements ProcessorInterface { this.cache.setLastSubmittedSubnetHeader(lastestSubnetCommittedBlock); } // Keep the "jobId: NAME" and its repeat configuration here so that bull won't create a new repeated job each time we run this code. - (await this.queue.add({}, REPEAT_JOB_OPT)).name; + await this.queue.add({}, REPEAT_JOB_OPT); } catch (error) { this.logger.error( `Error while bootstraping, system will go into sleep mode for ${ @@ -81,7 +81,6 @@ export class Standard implements ProcessorInterface { ); await sleep(config.reBootstrapWaitingTime); this.reset(); - // TODO: Add back the notification } } diff --git a/src/processors/zero.ts b/src/processors/zero.ts index f8b0d62..6cfefa2 100644 --- a/src/processors/zero.ts +++ b/src/processors/zero.ts @@ -5,6 +5,7 @@ import { ZeroService } from "../service/zero"; import { config } from "../config"; const NAME = "ZERO"; +const REPEAT_JOB_OPT = { jobId: NAME, repeat: { cron: config.cronJob.zeroJobExpression}}; export class Zero implements ProcessorInterface { private queue: Bull.Queue; @@ -18,6 +19,7 @@ export class Zero implements ProcessorInterface { } init() { this.logger.info("Initialising XDC-Zero"); + this.zeroService.init(); this.queue.process(async (_, done) => { this.logger.info("⏰ Executing xdc-zero periodically"); try { @@ -35,7 +37,7 @@ export class Zero implements ProcessorInterface { } async reset(): Promise { - await this.queue.add({}, { jobId: NAME, repeat: { cron: config.cronJob.zeroJobExpression}}); + await this.queue.add({}, REPEAT_JOB_OPT); } async processEvent() { diff --git a/src/service/mainnet/extensions.ts b/src/service/mainnet/extensions.ts index 9643b2f..4d4060b 100644 --- a/src/service/mainnet/extensions.ts +++ b/src/service/mainnet/extensions.ts @@ -13,7 +13,7 @@ export const mainnetExtensions = { property: MAINNET_EXTENSION_NAME, methods: [ { - name: "networkInformation", + name: "getNetworkInformation", call: "XDPoS_networkInformation" } ] diff --git a/src/service/subnet/extensions.ts b/src/service/subnet/extensions.ts index 5fc36ed..3023632 100644 --- a/src/service/subnet/extensions.ts +++ b/src/service/subnet/extensions.ts @@ -63,7 +63,7 @@ export const subnetExtensions = { params: 1, call: "XDPoS_getV2BlockByHash" }, { - name: "networkInformation", + name: "getNetworkInformation", params: 0, call: "XDPoS_networkInformation" },