Handle async queue sending error to not fail if any mailserver succeeds

This commit is contained in:
Devon Hudson 2022-11-29 18:22:00 -07:00
parent 266bf20a85
commit 22ec1deaca
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628

View file

@ -392,8 +392,17 @@ func (oq *destinationQueue) nextTransaction(
if oq.statistics.AssumedOffline() && len(mailservers) > 0 {
// TODO : how to pass through actual userID here?!?!?!?!
userID, _ := gomatrixserverlib.NewUserID("@:"+string(oq.origin), false)
anySuccess := false
for _, mailserver := range mailservers {
_, _ = oq.client.SendAsyncTransaction(ctx, *userID, t, mailserver)
_, asyncErr := oq.client.SendAsyncTransaction(ctx, *userID, t, mailserver)
if asyncErr != nil {
err = asyncErr
} else {
anySuccess = true
}
}
if anySuccess {
err = nil
}
} else {
_, err = oq.client.SendTransaction(ctx, t)