Skip to content

Commit

Permalink
fix shouldLog
Browse files Browse the repository at this point in the history
  • Loading branch information
lyoshenka committed Aug 31, 2018
1 parent 4ed52e2 commit 5d844fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reflector/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *stats) AddStream() {
s.streams++
}

func (s *stats) AddError(e error) (shouldLog bool) { // shouldLog is a hack, but whataever
func (s *stats) AddError(e error) (shouldLog bool) { // shouldLog is a hack, but whatever
if e == nil {
return
}
Expand All @@ -70,9 +70,10 @@ func (s *stats) AddError(e error) (shouldLog bool) { // shouldLog is a hack, but
name = "i/o timeout"
} else if strings.Contains(err.Error(), "read: connection reset by peer") {
name = "read conn reset"
} else {
shouldLog = true
}

shouldLog = true
s.mu.Lock()
defer s.mu.Unlock()
s.errors[name]++
Expand Down

0 comments on commit 5d844fc

Please sign in to comment.