We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook, Instagram and Microsoft search (Bing) work. They are set only if you accept. See our Privacy Policy for details.
Home / Review the AI's PR / Go
The ask: “Make ProcessAll handle jobs in parallel and return every result, or the first error.”
Context: Called from an HTTP handler; jobs can fail and should not hang the request.
Click any added line you would block in review and say why. This change has 2 planted defects.
| 12 | func ProcessAll(jobs []Job) ([]Result, error) { | |
| - | var results []Result | |
| - | for _, j := range jobs { | |
| - | r, err := j.Run() | |
| - | if err != nil { | |
| - | return nil, err | |
| - | } | |
| - | results = append(results, r) | |
| - | } | |
| - | return results, nil | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | } |