From 27c5646680fe61f35b668a325613da5215f94522 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Tue, 12 Nov 2019 10:36:32 +0300 Subject: [PATCH] Make proxyconn channel response async --- hub/proxy_conn.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hub/proxy_conn.go b/hub/proxy_conn.go index bbfa428..b333f96 100644 --- a/hub/proxy_conn.go +++ b/hub/proxy_conn.go @@ -12,6 +12,8 @@ import ( const ( proxyConnWriteTimeout = 2 * time.Minute proxyConnReadTimeout = 2 * time.Minute + + proxyConnBackpressureAfter = 10 ) type ProxyConn struct { @@ -69,7 +71,7 @@ func (p *ProxyConn) Close() { func newProxyConn(req *protocol.TelegramRequest, channelClosed chan<- conntypes.ConnID) *ProxyConn { return &ProxyConn{ - channelResponse: make(chan *rpc.ProxyResponse), + channelResponse: make(chan *rpc.ProxyResponse, proxyConnBackpressureAfter), channelDone: make(chan struct{}), channelClosed: channelClosed, req: req,