Fix Memory Leak caused by the merge_context.
The now removed statement of sending an empty struct into the channel blocked the goroutine until the channel of Done got listened for. This led to a goroutine leak as one does not necessarily has to call the Done function of a context. We fix this issue by removing this value. It was unnecessary anyway as a closed channel always returns the null-value of the returned type.
This commit is contained in:

committed by
Sebastian Serth

parent
b06ff4088f
commit
188d012bc4
@ -39,7 +39,6 @@ func (m mergeContext) Done() <-chan struct{} {
|
|||||||
}
|
}
|
||||||
go func(cases []reflect.SelectCase, ch chan struct{}) {
|
go func(cases []reflect.SelectCase, ch chan struct{}) {
|
||||||
_, _, _ = reflect.Select(cases)
|
_, _, _ = reflect.Select(cases)
|
||||||
ch <- struct{}{}
|
|
||||||
close(ch)
|
close(ch)
|
||||||
}(cases, ch)
|
}(cases, ch)
|
||||||
return ch
|
return ch
|
||||||
|
Reference in New Issue
Block a user