diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-09-08 13:41:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-08 13:41:08 +0100 |
commit | 668a722ee0e85b1f058962bd4df96ae542018a23 (patch) | |
tree | 9496797e943b080f54525163a78071cd7dec5ce0 /federationsender | |
parent | 726ad6ce2e0a030eae522bd9ac2a660cf04f36a8 (diff) |
Backoff for 401s (#1410)
* Backoff for 401s
* Human-readable retry_after in logs
Diffstat (limited to 'federationsender')
-rw-r--r-- | federationsender/api/api.go | 2 | ||||
-rw-r--r-- | federationsender/internal/api.go | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/federationsender/api/api.go b/federationsender/api/api.go index 655d1d10..adc3b34c 100644 --- a/federationsender/api/api.go +++ b/federationsender/api/api.go @@ -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. diff --git a/federationsender/internal/api.go b/federationsender/internal/api.go index 61663be3..2a70f7ed 100644 --- a/federationsender/internal/api.go +++ b/federationsender/internal/api.go @@ -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 |