Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Commit

Permalink
swarm/network: update syncer metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
acud authored and nonsense committed May 10, 2019
1 parent 297fa18 commit 9b1543c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions swarm/network/stream/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
timerC <-chan time.Time
)

defer func() {
metrics.GetOrRegisterResettingTimer("syncer.set-next-batch.total-time", nil).UpdateSince(batchStart)
defer func(start time.Time) {
metrics.GetOrRegisterResettingTimer("syncer.set-next-batch.total-time", nil).UpdateSince(start)
metrics.GetOrRegisterCounter("syncer.set-next-batch.batch-size", nil).Inc(int64(batchSize))
if timer != nil {
timer.Stop()
}
}()
}(batchStart)

for iterate := true; iterate; {
select {
Expand Down Expand Up @@ -167,7 +167,6 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
log.Debug("syncer pull subscription timer expired", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID)
case <-s.quit:
iterate = false
metrics.GetOrRegisterCounter("syncer.set-next-batch.quit-sig", nil).Inc(1)
log.Debug("syncer pull subscription - quit received", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID)
}
}
Expand Down

0 comments on commit 9b1543c

Please sign in to comment.