mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-21 04:53:14 -06:00
Handle HTTP errors
This commit is contained in:
parent
bdf9b2cee3
commit
5518f985ba
|
|
@ -407,10 +407,13 @@ userLoop:
|
||||||
waitTime = e.RetryAfter
|
waitTime = e.RetryAfter
|
||||||
} else if e.Blacklisted {
|
} else if e.Blacklisted {
|
||||||
waitTime = time.Hour * 8
|
waitTime = time.Hour * 8
|
||||||
} else {
|
break userLoop
|
||||||
|
} else if e.Code > 0 {
|
||||||
|
// We didn't get a real FederationClientError (e.g. in polylith mode, where gomatrix.HTTPError
|
||||||
|
// are "converted" to FederationClientError), but we probably shouldn't hit them every $waitTime seconds.
|
||||||
waitTime = time.Hour
|
waitTime = time.Hour
|
||||||
|
break userLoop
|
||||||
}
|
}
|
||||||
break userLoop
|
|
||||||
case net.Error:
|
case net.Error:
|
||||||
// Use the default waitTime, if it's a timeout.
|
// Use the default waitTime, if it's a timeout.
|
||||||
// It probably doesn't make sense to try further users.
|
// It probably doesn't make sense to try further users.
|
||||||
|
|
@ -420,8 +423,9 @@ userLoop:
|
||||||
break userLoop
|
break userLoop
|
||||||
}
|
}
|
||||||
case gomatrix.HTTPError:
|
case gomatrix.HTTPError:
|
||||||
// The remote server returned an error, give it some time to recover
|
// The remote server returned an error, give it some time to recover.
|
||||||
if e.Code >= 500 {
|
// This is to avoid spamming remote servers, which may not be Matrix servers anymore.
|
||||||
|
if e.Code >= 300 {
|
||||||
waitTime = time.Minute * 10
|
waitTime = time.Minute * 10
|
||||||
logrus.WithError(e).Error("GetUserDevices returned gomatrix.HTTPError")
|
logrus.WithError(e).Error("GetUserDevices returned gomatrix.HTTPError")
|
||||||
break userLoop
|
break userLoop
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue