Use mutex when appending to error (#2201)
## Description Make error appending thread-safe since multiple goroutines may attempt to add an error at the same time. ## Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No ## Type of change - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup ## Issue(s) * closes #2197 ## Test Plan - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
4473215882
commit
298ee35f05
@ -197,7 +197,11 @@ func (col *Collection) streamItems(ctx context.Context) {
|
||||
semaphoreCh := make(chan struct{}, urlPrefetchChannelBufferSize)
|
||||
defer close(semaphoreCh)
|
||||
|
||||
updaterMu := sync.Mutex{}
|
||||
errUpdater := func(user string, err error) {
|
||||
updaterMu.Lock()
|
||||
defer updaterMu.Unlock()
|
||||
|
||||
errs = support.WrapAndAppend(user, err, errs)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user