Skip to content

Commit

Permalink
add rr logs (#2143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Intizar-T authored Aug 19, 2024
1 parent d4436b4 commit e3bc4a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/listener/listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Job, Queue, Worker } from 'bullmq'
import { ethers } from 'ethers'
import { performance } from 'perf_hooks'
import { Logger } from 'pino'
import type { RedisClientType } from 'redis'
import { BULLMQ_CONNECTION, LISTENER_JOB_SETTINGS } from '../settings'
Expand Down Expand Up @@ -358,6 +359,7 @@ function processEventJob({
const _logger = logger.child({ name: 'processEventJob', file: FILE_NAME })

async function wrapper(job: Job) {
const start = performance.now()
const inData: IProcessEventListenerJob = job.data
const { events, blockNumber } = inData

Expand All @@ -383,6 +385,11 @@ function processEventJob({
blockNumber,
service,
})

if (events.length > 0) {
const endTime = performance.now()
_logger.info(`Passed ${events.length} events in ${endTime - start} ms`)
}
} catch (e) {
_logger.error(e, 'Error in user defined listener processing function')
throw e
Expand Down
2 changes: 2 additions & 0 deletions core/src/reporter/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export function reporter(state: State, logger: Logger) {

txParams.nonce = localNonce
}

logger.info(`Transaction sent to ${to} with nonce ${localNonce}`)
}

logger.debug('Reporter job built')
Expand Down
1 change: 1 addition & 0 deletions core/src/reporter/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export class State {
async getAndIncrementNonce(oracleAddress: string): Promise<number> {
return await this.mutex.runExclusive(async () => {
const nonce = this.nonces[oracleAddress]
this.logger.info(`nonce for ${oracleAddress} is ${nonce}`)
this.nonces[oracleAddress] = nonce + 1

return nonce
Expand Down

0 comments on commit e3bc4a9

Please sign in to comment.