Skip to content

Commit

Permalink
chore: Added logs to indicate simulation submission. Addresses #28
Browse files Browse the repository at this point in the history
  • Loading branch information
anomit committed Jan 6, 2025
1 parent f2dc5d9 commit d1bd88c
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions pkgs/service/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,23 @@ func (s *server) writeToStream(data []byte, submissionId string, submission *pkg
success := false
defer func() {
if !success {
log.Errorf("❌ Failed defer for submission (Project: %s, Epoch: %d) with ID: %s: %v",
submission.Request.ProjectId, submission.Request.EpochId, submissionId, err)
if submission.Request.EpochId == 0 {
log.Errorf("❌ Failed defer for SIMULATION snapshot submission (Project: %s, Epoch: %d) with ID: %s: %v",
submission.Request.ProjectId, submission.Request.EpochId, submissionId, err)
} else {
log.Errorf("❌ Failed defer for snapshot submission (Project: %s, Epoch: %d) with ID: %s: %v",
submission.Request.ProjectId, submission.Request.EpochId, submissionId, err)
}
stream.Reset()
stream.Close()
} else {
log.Infof("⏰ Succesful defer for submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
if submission.Request.EpochId == 0 {
log.Infof("⏰ Succesful defer for SIMULATION snapshot submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
} else {
log.Infof("⏰ Succesful defer for snapshot submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
}
// Get metrics and increment success counter
if metrics := s.getOrCreateEpochMetrics(submission.Request.EpochId); metrics != nil {
metrics.succeeded.Add(1)
Expand All @@ -157,8 +167,13 @@ func (s *server) writeToStream(data []byte, submissionId string, submission *pkg
}

success = true
log.Infof("✅ Successfully wrote to stream for submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
if submission.Request.EpochId == 0 {
log.Infof("✅ Successfully wrote to stream for SIMULATION snapshot submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
} else {
log.Infof("✅ Successfully wrote to stream for snapshot submission (Project: %s, Epoch: %d) with ID: %s",
submission.Request.ProjectId, submission.Request.EpochId, submissionId)
}
return nil
}

Expand Down

0 comments on commit d1bd88c

Please sign in to comment.