aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-08-01 15:55:56 +0100
committerGitHub <noreply@github.com>2022-08-01 15:55:56 +0100
commite94ef84aaba30e12baf7f524c4e7a36d2fdeb189 (patch)
treea22fd4988081a33cc3b3d54797dfaae4f3330c00
parent119cde37668badb04b9ca9445cf1d87a880bcbd5 (diff)
De-race `CompleteSync` (#2601)
The `err` was coming from outside of the goroutine and being written to by concurrent goroutines.
-rw-r--r--syncapi/streams/stream_pdu.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go
index 00b3dfe3..1832adbe 100644
--- a/syncapi/streams/stream_pdu.go
+++ b/syncapi/streams/stream_pdu.go
@@ -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
}