Cleanup logging
This commit is contained in:
parent
1b485256a3
commit
db02bf40b9
|
@ -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() {
|
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++ {
|
for height := span.Start.Height; height <= span.End.Height; height++ {
|
||||||
s.dailyActiveBlock(height, peerip)
|
s.dailyActiveBlock(height, peerip)
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
|
|
||||||
common.Log.WithFields(logrus.Fields{
|
common.Log.WithFields(logrus.Fields{
|
||||||
"method": "GetBlockRange",
|
"method": "GetBlockRange",
|
||||||
|
@ -308,17 +308,16 @@ func (s *lwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.C
|
||||||
"end": span.End.Height,
|
"end": span.End.Height,
|
||||||
"peer_addr": peerip,
|
"peer_addr": peerip,
|
||||||
}).Info("Service")
|
}).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))
|
go common.GetBlockRange(s.cache, blockChan, errChan, int(span.Start.Height), int(span.End.Height))
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
// this will also catch context.DeadlineExceeded from the timeout
|
|
||||||
//common.Metrics.TotalErrors.Inc()
|
|
||||||
return err
|
return err
|
||||||
case cBlock := <-blockChan:
|
case cBlock := <-blockChan:
|
||||||
common.Metrics.TotalBlocksServedConter.Inc()
|
|
||||||
err := resp.Send(cBlock)
|
err := resp.Send(cBlock)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue