mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 06:26:17 +03:00
honor canceled context and do not leak on mergeChannels (#15034)
mergeEntryChannels has the potential to perpetually wait on the results channel, context might be closed and we did not honor the caller context canceling.
This commit is contained in:
@@ -695,8 +695,12 @@ func mergeEntryChannels(ctx context.Context, in []chan metaCacheEntry, out chan<
|
||||
}
|
||||
}
|
||||
if best.name > last {
|
||||
out <- *best
|
||||
last = best.name
|
||||
select {
|
||||
case <-ctxDone:
|
||||
return ctx.Err()
|
||||
case out <- *best:
|
||||
last = best.name
|
||||
}
|
||||
} else if serverDebugLog {
|
||||
console.Debugln("mergeEntryChannels: discarding duplicate", best.name, "<=", last)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user