Skip to content

Commit

Permalink
chore(evmindexer): improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
guybrush committed Nov 12, 2024
1 parent ec806e3 commit e1d6c09
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backend/cmd/evm_node_indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ func Run() {

// check config
{

cfg := &types.Config{}
err := utils.ReadConfig(cfg, *configPath)
if err != nil {
Expand Down Expand Up @@ -279,6 +278,18 @@ func Run() {
updateBlockNumber(true, *noNewBlocks, time.Duration(*noNewBlocksThresholdSeconds)*time.Second, discordWebhookReportUrl, discordWebhookUser, discordWebhookAddTextFatal)
log.Infof("...get latest block (%s) from node done.", _formatInt64(currentNodeBlockNumber.Load()))

go func() {
for {
latestPGBlock, err := psqlGetLatestBlock(false)
if err != nil {
log.Fatal(err, "error while using psqlGetLatestBlock (start / read)", 0) // fatal, as if there is no initial value, we have nothing to start from
}

sendMessage(fmt.Sprintf("evmindexer for %s, version: %v, lastNodeBlock: %v, lastDbBlock: %v", getChainNamePretty(), version.Version, currentNodeBlockNumber.Load(), latestPGBlock), discordWebhookReportUrl, discordWebhookUser)
time.Sleep(time.Hour)
}
}()

// //////////////////////////////////////////
// Config done, now actually "doing" stuff //
// //////////////////////////////////////////
Expand Down

0 comments on commit e1d6c09

Please sign in to comment.