Skip to content

`lib/group`: add error to error group before canceling

Warren Gifford requested to merge cc/direct-add-error into main

Created by: camdencheek

This fixes a minor race condition where the error returned when WithFirstError might not actually be the first error because we cancel the context before collecting the error, which means another goroutine might return a context canceled error and accumulate it before the triggering error is collected.

Flake here

Test plan

There are existing tests to cover this, but it is a really difficult condition to hit. I tried running tests locally 100 times and hit no failures.

Merge request reports

Loading