Success updates the server statistics with a new successful attempt, which increases the sent counter and resets the idle and failure counters. If a host was blacklisted at this point then we will unblacklist it.
()
| 93 | // failure counters. If a host was blacklisted at this point then |
| 94 | // we will unblacklist it. |
| 95 | func (s *ServerStatistics) Success() { |
| 96 | s.cancel() |
| 97 | s.successCounter.Inc() |
| 98 | s.backoffCount.Store(0) |
| 99 | if s.statistics.DB != nil { |
| 100 | if err := s.statistics.DB.RemoveServerFromBlacklist(s.serverName); err != nil { |
| 101 | logrus.WithError(err).Errorf("Failed to remove %q from blacklist", s.serverName) |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | // Failure marks a failure and starts backing off if needed. |
| 107 | // The next call to BackoffIfRequired will do the right thing |