2022-02-09 12:10:02 +01:00
|
|
|
package channel
|
|
|
|
|
|
|
|
func determineBufferSize[T any](channels []<-chan T) int {
|
|
|
|
if len(channels) == 0 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2022-04-25 15:37:00 +02:00
|
|
|
maxBufSize := 0
|
2022-02-09 12:10:02 +01:00
|
|
|
for _, ch := range channels {
|
2022-04-25 15:37:00 +02:00
|
|
|
if cap(ch) > maxBufSize {
|
|
|
|
maxBufSize = cap(ch)
|
|
|
|
}
|
2022-02-09 12:10:02 +01:00
|
|
|
}
|
2022-04-25 15:37:00 +02:00
|
|
|
return maxBufSize
|
2022-02-09 12:10:02 +01:00
|
|
|
}
|