Skip to content

Commit

Permalink
fix small bug related to xdc-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrjerome committed Dec 6, 2023
1 parent a9e63f1 commit 915edda
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/processors/standard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${
Expand All @@ -81,7 +81,6 @@ export class Standard implements ProcessorInterface {
);
await sleep(config.reBootstrapWaitingTime);
this.reset();
// TODO: Add back the notification
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/processors/zero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -35,7 +37,7 @@ export class Zero implements ProcessorInterface {
}

async reset(): Promise<void> {
await this.queue.add({}, { jobId: NAME, repeat: { cron: config.cronJob.zeroJobExpression}});
await this.queue.add({}, REPEAT_JOB_OPT);
}

async processEvent() {
Expand Down
2 changes: 1 addition & 1 deletion src/service/mainnet/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const mainnetExtensions = {
property: MAINNET_EXTENSION_NAME,
methods: [
{
name: "networkInformation",
name: "getNetworkInformation",
call: "XDPoS_networkInformation"
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/service/subnet/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const subnetExtensions = {
params: 1,
call: "XDPoS_getV2BlockByHash"
}, {
name: "networkInformation",
name: "getNetworkInformation",
params: 0,
call: "XDPoS_networkInformation"
},
Expand Down

0 comments on commit 915edda

Please sign in to comment.