Skip to content

Commit f66f79a

Browse files
authored
Use buffered channels for close notify signaling (awslabs#78)
Using unbuffered channels results in potential blocks during `notifyClosed` if calling code fails or is otherwise unable to receive on the returned channel. In particular this fixes an issue where calling code was awaiting either notify close or context done. When context done happened first this caused the notifyClose call to hang, causing an api gateway timeout.
1 parent 5e4a039 commit f66f79a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewProxyResponseWriter() *ProxyResponseWriter {
3737
}
3838

3939
func (r *ProxyResponseWriter) CloseNotify() <-chan bool {
40-
ch := make(chan bool)
40+
ch := make(chan bool, 1)
4141

4242
r.observers = append(r.observers, ch)
4343

0 commit comments

Comments
 (0)