Don't block on roomserver (experimental)

This commit is contained in:
Neil Alexander 2020-04-20 11:15:15 +01:00
parent 029e750e1e
commit 426ab83bc1

View file

@ -15,6 +15,7 @@
package routing package routing
import ( import (
"context"
"fmt" "fmt"
"net/http" "net/http"
"strings" "strings"
@ -407,13 +408,19 @@ retryCheck:
} }
} }
if err = r.producer.SendEventWithState( // TODO: think about this some more, otherwise the request blocks and can time
r.req.Context(), // out on the roomserver processing the new room state, when the syncapi etc
gomatrixserverlib.RespState(respSendJoin.RespState), // would eventually get those events anyway?
event.Headered(respMakeJoin.RoomVersion), go func() {
); err != nil { ctx := context.TODO()
return nil, fmt.Errorf("r.producer.SendEventWithState: %w", err) if err = r.producer.SendEventWithState(
} ctx, //r.req.Context(),
gomatrixserverlib.RespState(respSendJoin.RespState),
event.Headered(respMakeJoin.RoomVersion),
); err != nil {
util.GetLogger(ctx).WithError(err).Error("r.producer.SendEventWithState")
}
}()
return &util.JSONResponse{ return &util.JSONResponse{
Code: http.StatusOK, Code: http.StatusOK,