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:
} }
} }
// TODO: think about this some more, otherwise the request blocks and can time
// out on the roomserver processing the new room state, when the syncapi etc
// would eventually get those events anyway?
go func() {
ctx := context.TODO()
if err = r.producer.SendEventWithState( if err = r.producer.SendEventWithState(
r.req.Context(), ctx, //r.req.Context(),
gomatrixserverlib.RespState(respSendJoin.RespState), gomatrixserverlib.RespState(respSendJoin.RespState),
event.Headered(respMakeJoin.RoomVersion), event.Headered(respMakeJoin.RoomVersion),
); err != nil { ); err != nil {
return nil, fmt.Errorf("r.producer.SendEventWithState: %w", err) util.GetLogger(ctx).WithError(err).Error("r.producer.SendEventWithState")
} }
}()
return &util.JSONResponse{ return &util.JSONResponse{
Code: http.StatusOK, Code: http.StatusOK,