bug: fix the last error being missed in ReleaseTimeout() for multi-pool (#334)

This commit is contained in:
Andy Pan 2024-06-18 12:09:09 +08:00 committed by GitHub
parent b40e489286
commit 313f136d00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 20 deletions

View File

@ -201,16 +201,9 @@ func (mp *MultiPool) ReleaseTimeout(timeout time.Duration) error {
_ = wg.Wait()
var (
i int
errStr strings.Builder
)
for err := range errCh {
i++
if i == len(mp.pools) {
break
}
if err != nil {
var errStr strings.Builder
for i := 0; i < len(mp.pools); i++ {
if err := <-errCh; err != nil {
errStr.WriteString(err.Error())
errStr.WriteString(" | ")
}

View File

@ -191,16 +191,9 @@ func (mp *MultiPoolWithFunc) ReleaseTimeout(timeout time.Duration) error {
_ = wg.Wait()
var (
i int
errStr strings.Builder
)
for err := range errCh {
i++
if i == len(mp.pools) {
break
}
if err != nil {
var errStr strings.Builder
for i := 0; i < len(mp.pools); i++ {
if err := <-errCh; err != nil {
errStr.WriteString(err.Error())
errStr.WriteString(" | ")
}