aboutsummaryrefslogtreecommitdiff
path: root/federationapi
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-09-03 15:22:16 +0100
committerGitHub <noreply@github.com>2020-09-03 15:22:16 +0100
commit6150de6cb3611ffc61ce10ed6714f65e51e38e78 (patch)
tree7c89defb2634b19497f4911e9851f35d8b101af7 /federationapi
parent74743ac8ae3cc439862acd15d13ba4123d745598 (diff)
FIFO ordering of input events (#1386)
* Initial FIFOing of roomserver inputs * Remove EventID response from api.InputRoomEventsResponse * Don't send back event ID unnecessarily * Fix ordering hopefully * Reduce copies, use buffered task channel to reduce contention on other rooms * Fix error handling
Diffstat (limited to 'federationapi')
-rw-r--r--federationapi/routing/join.go5
-rw-r--r--federationapi/routing/leave.go5
-rw-r--r--federationapi/routing/send.go3
-rw-r--r--federationapi/routing/threepid.go4
4 files changed, 7 insertions, 10 deletions
diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go
index 6cac1245..36afe30a 100644
--- a/federationapi/routing/join.go
+++ b/federationapi/routing/join.go
@@ -266,15 +266,14 @@ func SendJoin(
// We are responsible for notifying other servers that the user has joined
// the room, so set SendAsServer to cfg.Matrix.ServerName
if !alreadyJoined {
- _, err = api.SendEvents(
+ if err = api.SendEvents(
httpReq.Context(), rsAPI,
[]gomatrixserverlib.HeaderedEvent{
event.Headered(stateAndAuthChainResponse.RoomVersion),
},
cfg.Matrix.ServerName,
nil,
- )
- if err != nil {
+ ); err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("SendEvents failed")
return jsonerror.InternalServerError()
}
diff --git a/federationapi/routing/leave.go b/federationapi/routing/leave.go
index 51162344..8bb0a8a9 100644
--- a/federationapi/routing/leave.go
+++ b/federationapi/routing/leave.go
@@ -247,15 +247,14 @@ func SendLeave(
// Send the events to the room server.
// We are responsible for notifying other servers that the user has left
// the room, so set SendAsServer to cfg.Matrix.ServerName
- _, err = api.SendEvents(
+ if err = api.SendEvents(
httpReq.Context(), rsAPI,
[]gomatrixserverlib.HeaderedEvent{
event.Headered(verRes.RoomVersion),
},
cfg.Matrix.ServerName,
nil,
- )
- if err != nil {
+ ); err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("producer.SendEvents failed")
return jsonerror.InternalServerError()
}
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go
index cad77921..570062ad 100644
--- a/federationapi/routing/send.go
+++ b/federationapi/routing/send.go
@@ -382,7 +382,7 @@ func (t *txnReq) processEvent(e gomatrixserverlib.Event, isInboundTxn bool) erro
}
// pass the event to the roomserver
- _, err := api.SendEvents(
+ return api.SendEvents(
t.context, t.rsAPI,
[]gomatrixserverlib.HeaderedEvent{
e.Headered(stateResp.RoomVersion),
@@ -390,7 +390,6 @@ func (t *txnReq) processEvent(e gomatrixserverlib.Event, isInboundTxn bool) erro
api.DoNotSendToOtherServers,
nil,
)
- return err
}
func checkAllowedByState(e gomatrixserverlib.Event, stateEvents []gomatrixserverlib.Event) error {
diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go
index e8d9a939..ec6cc148 100644
--- a/federationapi/routing/threepid.go
+++ b/federationapi/routing/threepid.go
@@ -89,7 +89,7 @@ func CreateInvitesFrom3PIDInvites(
}
// Send all the events
- if _, err := api.SendEvents(req.Context(), rsAPI, evs, cfg.Matrix.ServerName, nil); err != nil {
+ if err := api.SendEvents(req.Context(), rsAPI, evs, cfg.Matrix.ServerName, nil); err != nil {
util.GetLogger(req.Context()).WithError(err).Error("SendEvents failed")
return jsonerror.InternalServerError()
}
@@ -172,7 +172,7 @@ func ExchangeThirdPartyInvite(
}
// Send the event to the roomserver
- if _, err = api.SendEvents(
+ if err = api.SendEvents(
httpReq.Context(), rsAPI,
[]gomatrixserverlib.HeaderedEvent{
signedEvent.Event.Headered(verRes.RoomVersion),