Cleanup logging

This commit is contained in:
Aditya Kulkarni 2021-07-28 19:34:41 -07:00
parent 1b485256a3
commit db02bf40b9
1 changed files with 10 additions and 11 deletions

View File

@ -295,12 +295,12 @@ func (s *lwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.C
}
}()
// Log a daily active user if the user requests the day's "key block"
// Logging and metrics
go func() {
// Log a daily active user if the user requests the day's "key block"
for height := span.Start.Height; height <= span.End.Height; height++ {
s.dailyActiveBlock(height, peerip)
}
}()
common.Log.WithFields(logrus.Fields{
"method": "GetBlockRange",
@ -308,17 +308,16 @@ func (s *lwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.C
"end": span.End.Height,
"peer_addr": peerip,
}).Info("Service")
common.Metrics.TotalBlocksServedConter.Add(math.Abs(float64(span.Start.Height) - float64(span.End.Height)))
}()
go common.GetBlockRange(s.cache, blockChan, errChan, int(span.Start.Height), int(span.End.Height))
for {
select {
case err := <-errChan:
// this will also catch context.DeadlineExceeded from the timeout
//common.Metrics.TotalErrors.Inc()
return err
case cBlock := <-blockChan:
common.Metrics.TotalBlocksServedConter.Inc()
err := resp.Send(cBlock)
if err != nil {
return err