Alter comments in parallel.go for readability (#16032)

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
pull/16050/head
XuanYang-cn 2022-03-15 10:26:01 +08:00 committed by GitHub
parent fd405bc2d6
commit d4a0c5eba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ func GetFunctionName(i interface{}) string {
}
// ProcessFuncParallel process function in parallel.
//
// ProcessFuncParallel waits for all goroutines done if no errors occur.
// If some goroutines return error, ProcessFuncParallel cancels other goroutines as soon as possible and wait
// for all other goroutines done, and returns the first error occurs.
// Reference: https://stackoverflow.com/questions/40809504/idiomatic-goroutine-termination-and-error-handling
func ProcessFuncParallel(total, maxParallel int, f func(idx int) error, fname string) error {
if maxParallel <= 0 {