From 5daf68afa2443cd2dc5eacb54bc2eac8d005fd91 Mon Sep 17 00:00:00 2001 From: Ivan S Date: Wed, 17 Apr 2024 14:06:26 +0800 Subject: [PATCH] fix monitoring for rounds --- main/src/modules/Monitoring/helpers/database.ts | 4 ++-- .../src/modules/PolkadotStakingProcessor/helpers/database.ts | 2 +- main/src/modules/PolkadotStakingProcessor/service.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main/src/modules/Monitoring/helpers/database.ts b/main/src/modules/Monitoring/helpers/database.ts index e8af10c4..e1ec2194 100644 --- a/main/src/modules/Monitoring/helpers/database.ts +++ b/main/src/modules/Monitoring/helpers/database.ts @@ -6,7 +6,7 @@ import { Logger } from 'pino' @Service() export class MonitoringDatabaseHelper { - constructor(@Inject('knex') private readonly knex: Knex, @Inject('logger') private readonly logger: Logger) {} + constructor(@Inject('knex') private readonly knex: Knex, @Inject('logger') private readonly logger: Logger) { } async removeOldExtrinsicsBody(): Promise { const sql = ` @@ -61,7 +61,7 @@ export class MonitoringDatabaseHelper { if (!lastRoundId) return [] const missedRoundsSQL = ` SELECT generate_series(3, ${lastRoundId - 3}) as missing_round except - SELECT round_id FROM rewards_eras WHERE network_id=${environment.NETWORK_ID} + SELECT round_id FROM rewards_rounds WHERE network_id=${environment.NETWORK_ID} ORDER BY missing_round LIMIT 10` const missedRoundsRows = await this.knex.raw(missedRoundsSQL) diff --git a/main/src/modules/PolkadotStakingProcessor/helpers/database.ts b/main/src/modules/PolkadotStakingProcessor/helpers/database.ts index cc8f2baf..104daae6 100644 --- a/main/src/modules/PolkadotStakingProcessor/helpers/database.ts +++ b/main/src/modules/PolkadotStakingProcessor/helpers/database.ts @@ -17,7 +17,7 @@ const network = { network_id: environment.NETWORK_ID } @Service() export class PolkadotStakingProcessorDatabaseHelper { - constructor(@Inject('knex') private readonly knex: Knex) {} + constructor(@Inject('knex') private readonly knex: Knex) { } async saveValidators(trx: Knex.Transaction, validator: ValidatorModel): Promise { await ValidatorModel(this.knex) diff --git a/main/src/modules/PolkadotStakingProcessor/service.ts b/main/src/modules/PolkadotStakingProcessor/service.ts index 8ac150e8..2b2f6e4a 100644 --- a/main/src/modules/PolkadotStakingProcessor/service.ts +++ b/main/src/modules/PolkadotStakingProcessor/service.ts @@ -16,7 +16,7 @@ export class PolkadotStakingProcessorService { private readonly polkadotHelper: PolkadotStakingProcessorPolkadotHelper, private readonly databaseHelper: PolkadotStakingProcessorDatabaseHelper, - ) {} + ) { } async processTaskMessage(trx: Knex.Transaction, taskRecord: ProcessingTaskModel): Promise<{ status: boolean }> { const { entity_id: eraId, collect_uid } = taskRecord @@ -145,7 +145,7 @@ export class PolkadotStakingProcessorService { }) //await this.databaseHelper.saveEra(trx, { ...eraData, payout_block_id: payout_block_id }) - + /* for (const validator of validators) { await this.databaseHelper.saveValidators(trx, { ...validator, block_time: new Date(payoutBlockTime) }) } @@ -153,6 +153,7 @@ export class PolkadotStakingProcessorService { for (const nominator of nominators) { await this.databaseHelper.saveNominators(trx, { ...nominator, block_time: new Date(payoutBlockTime) }) } + */ //rewards only await this.databaseHelper.saveRewardEra(trx, {