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:
Maximilian Paß
2023-08-26 22:30:20 +02:00
committed by Sebastian Serth
parent b06ff4088f
commit 188d012bc4

View File

@ -39,7 +39,6 @@ func (m mergeContext) Done() <-chan struct{} {
}
go func(cases []reflect.SelectCase, ch chan struct{}) {
_, _, _ = reflect.Select(cases)
ch <- struct{}{}
close(ch)
}(cases, ch)
return ch