mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Try sending to async mailservers if the conditions are right
This commit is contained in:
parent
116bdfc511
commit
266bf20a85
|
|
@ -387,7 +387,17 @@ func (oq *destinationQueue) nextTransaction(
|
||||||
ctx, cancel := context.WithTimeout(oq.process.Context(), time.Minute*5)
|
ctx, cancel := context.WithTimeout(oq.process.Context(), time.Minute*5)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := oq.client.SendTransaction(ctx, t)
|
var err error
|
||||||
|
mailservers := oq.statistics.KnownMailservers()
|
||||||
|
if oq.statistics.AssumedOffline() && len(mailservers) > 0 {
|
||||||
|
// TODO : how to pass through actual userID here?!?!?!?!
|
||||||
|
userID, _ := gomatrixserverlib.NewUserID("@:"+string(oq.origin), false)
|
||||||
|
for _, mailserver := range mailservers {
|
||||||
|
_, _ = oq.client.SendAsyncTransaction(ctx, *userID, t, mailserver)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_, err = oq.client.SendTransaction(ctx, t)
|
||||||
|
}
|
||||||
switch errResponse := err.(type) {
|
switch errResponse := err.(type) {
|
||||||
case nil:
|
case nil:
|
||||||
// Clean up the transaction in the database.
|
// Clean up the transaction in the database.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue