Skip to content

Commit

Permalink
fix monitoring for rounds
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrvano committed Apr 17, 2024
1 parent bd397b4 commit 5daf68a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions main/src/modules/Monitoring/helpers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const sql = `
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<any, any[]>, validator: ValidatorModel): Promise<void> {
await ValidatorModel(this.knex)
Expand Down
5 changes: 3 additions & 2 deletions main/src/modules/PolkadotStakingProcessor/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class PolkadotStakingProcessorService {

private readonly polkadotHelper: PolkadotStakingProcessorPolkadotHelper,
private readonly databaseHelper: PolkadotStakingProcessorDatabaseHelper,
) {}
) { }

async processTaskMessage(trx: Knex.Transaction, taskRecord: ProcessingTaskModel<ENTITY>): Promise<{ status: boolean }> {
const { entity_id: eraId, collect_uid } = taskRecord
Expand Down Expand Up @@ -145,14 +145,15 @@ 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) })
}
for (const nominator of nominators) {
await this.databaseHelper.saveNominators(trx, { ...nominator, block_time: new Date(payoutBlockTime) })
}
*/

//rewards only
await this.databaseHelper.saveRewardEra(trx, {
Expand Down

0 comments on commit 5daf68a

Please sign in to comment.