Try implementing async roomserver input

This commit is contained in:
Neil Alexander 2021-06-30 09:45:45 +01:00
parent 7b0ad24a45
commit 57be026e81
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
16 changed files with 44 additions and 23 deletions

View file

@ -166,17 +166,19 @@ func (r *Inputer) InputRoomEvents(
worker.input.push(tasks[i])
}
// Wait for all of the workers to return results about our tasks.
wg.Wait()
if !request.Asynchronous {
// Wait for all of the workers to return results about our tasks.
wg.Wait()
// If any of the tasks returned an error, we should probably report
// that back to the caller.
for _, task := range tasks {
if task.err != nil {
response.ErrMsg = task.err.Error()
_, rejected := task.err.(*gomatrixserverlib.NotAllowed)
response.NotAllowed = rejected
return
// If any of the tasks returned an error, we should probably report
// that back to the caller.
for _, task := range tasks {
if task.err != nil {
response.ErrMsg = task.err.Error()
_, rejected := task.err.(*gomatrixserverlib.NotAllowed)
response.NotAllowed = rejected
return
}
}
}
}