De-race CompleteSync (#2601)

The `err` was coming from outside of the goroutine and being written to by concurrent goroutines.
This commit is contained in:
Neil Alexander 2022-08-01 15:55:56 +01:00 committed by GitHub
parent 119cde3766
commit e94ef84aab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,12 +109,11 @@ func (p *PDUStreamProvider) CompleteSync(
p.queue(func() {
defer reqWaitGroup.Done()
var jr *types.JoinResponse
jr, err = p.getJoinResponseForCompleteSync(
jr, jerr := p.getJoinResponseForCompleteSync(
ctx, roomID, r, &stateFilter, &eventFilter, req.WantFullState, req.Device,
)
if err != nil {
req.Log.WithError(err).Error("p.getJoinResponseForCompleteSync failed")
if jerr != nil {
req.Log.WithError(jerr).Error("p.getJoinResponseForCompleteSync failed")
return
}