Process EDUs in parallel

This commit is contained in:
Neil Alexander 2021-07-02 10:16:18 +01:00
parent 55075a0cb5
commit 39afdcfdd3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -263,7 +263,12 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
pdus = nil // nolint:ineffassign
var wg sync.WaitGroup
wg.Add(len(perRoom))
wg.Add(len(perRoom) + 1)
go func() {
defer wg.Done()
t.processEDUs(ctx)
}()
for _, q := range perRoom {
go func(q chan *gomatrixserverlib.Event) {
@ -335,7 +340,6 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
perRoom[k] = nil
}
t.processEDUs(ctx)
if c := len(results); c > 0 {
util.GetLogger(ctx).Infof("Processed %d PDUs from transaction %q", c, t.TransactionID)
}