MCPcopy Create free account
hub / github.com/daodst/chat / Success

Method Success

federationapi/statistics/statistics.go:95–104  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

93// failure counters. If a host was blacklisted at this point then
94// we will unblacklist it.
95func (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

Callers 7

TestBackoffFunction · 0.95
backgroundSendMethod · 0.45
PerformLeaveMethod · 0.45

Calls 2

cancelMethod · 0.95

Tested by 1

TestBackoffFunction · 0.76