Skip to content

Commit

Permalink
improve logs (#56)
Browse files Browse the repository at this point in the history
* improve logs

* add to changelog
  • Loading branch information
xmariachi authored Sep 19, 2024
1 parent 806de49 commit a5376bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

* [#55](https://github.com/allora-network/allora-offchain-node/pull/55) Passive set retrial optimization.
* [#56](https://github.com/allora-network/allora-offchain-node/pull/56) Improve logs

### Security

Expand Down
12 changes: 6 additions & 6 deletions usecase/spawn_actor_processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ func (suite *UseCaseSuite) runWorkerProcess(worker lib.WorkerConfig) {
latestOpenWorkerNonce, err := suite.Node.GetLatestOpenWorkerNonceByTopicId(worker.TopicId)
if err != nil {
log.Error().Err(err).Uint64("topicId", worker.TopicId).Msg("Error getting latest open worker nonce on topic")
} else {
log.Debug().Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Got latest open worker nonce")
}

if latestOpenWorkerNonce.BlockHeight > latestNonceHeightActedUpon {
Expand All @@ -73,6 +71,8 @@ func (suite *UseCaseSuite) runWorkerProcess(worker lib.WorkerConfig) {
log.Error().Err(err).Uint64("topicId", worker.TopicId).Int64("BlockHeight", latestOpenWorkerNonce.BlockHeight).Msg("Error building and committing worker payload for topic")
}
latestNonceHeightActedUpon = latestOpenWorkerNonce.BlockHeight
} else {
log.Debug().Uint64("topicId", worker.TopicId).Msg("No new worker nonce found")
}

suite.Wait(worker.LoopSeconds)
Expand All @@ -90,21 +90,21 @@ func (suite *UseCaseSuite) runReputerProcess(reputer lib.ReputerConfig) {

latestNonceHeightActedUpon := int64(0)
for {
log.Debug().Uint64("topicId", reputer.TopicId).Msg("Checking for latest open reputer nonce")

latestOpenReputerNonce, err := suite.Node.GetOldestReputerNonceByTopicId(reputer.TopicId)
if err != nil {
log.Error().Err(err).Uint64("topicId", reputer.TopicId).Msg("Error getting latest open reputer nonce on topic")
log.Error().Err(err).Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Error getting latest open reputer nonce on topic")
}

if latestOpenReputerNonce > latestNonceHeightActedUpon {
log.Debug().Uint64("topicId", reputer.TopicId).Msg("Building and committing reputer payload for topic")
log.Debug().Uint64("topicId", reputer.TopicId).Int64("BlockHeight", latestOpenReputerNonce).Msg("Building and committing reputer payload for topic")

success, err := suite.BuildCommitReputerPayload(reputer, latestOpenReputerNonce)
if !success || err != nil {
log.Error().Err(err).Uint64("topicId", reputer.TopicId).Msg("Error building and committing reputer payload for topic")
}
latestNonceHeightActedUpon = latestOpenReputerNonce
} else {
log.Debug().Uint64("topicId", reputer.TopicId).Msg("No new reputer nonce found")
}

suite.Wait(reputer.LoopSeconds)
Expand Down

0 comments on commit a5376bf

Please sign in to comment.