Backoff for 401s (#1410)

* Backoff for 401s

* Human-readable retry_after in logs
This commit is contained in:
Neil Alexander 2020-09-08 13:41:08 +01:00 committed by GitHub
parent 726ad6ce2e
commit 668a722ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -30,7 +30,7 @@ type FederationClientError struct {
}
func (e *FederationClientError) Error() string {
return fmt.Sprintf("%s - (retry_after=%d, blacklisted=%v)", e.Err, e.RetryAfter, e.Blacklisted)
return fmt.Sprintf("%s - (retry_after=%s, blacklisted=%v)", e.Err, e.RetryAfter.String(), e.Blacklisted)
}
// FederationSenderInternalAPI is used to query information from the federation sender.

View File

@ -70,7 +70,10 @@ func failBlacklistableError(err error, stats *statistics.ServerStatistics) (unti
if !ok {
return stats.Failure()
}
if mxerr.Code >= 500 && mxerr.Code < 600 {
if mxerr.Code == 401 { // invalid signature in X-Matrix header
return stats.Failure()
}
if mxerr.Code >= 500 && mxerr.Code < 600 { // internal server errors
return stats.Failure()
}
return