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:
ashmrtn 2023-01-19 20:16:39 -08:00 committed by GitHub
parent 4473215882
commit 298ee35f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}