mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
grpcproxy: handle overloaded stream
This commit is contained in:
parent
0d07154926
commit
b56ee178d5
@ -67,7 +67,7 @@ func (wp *watchProxy) Watch(stream pb.Watch_WatchServer) (err error) {
|
||||
id: wp.nextStreamID,
|
||||
gRPCStream: stream,
|
||||
|
||||
watchCh: make(chan *pb.WatchResponse, 10),
|
||||
watchCh: make(chan *pb.WatchResponse, 1024),
|
||||
|
||||
proxyCtx: wp.ctx,
|
||||
}
|
||||
|
@ -15,6 +15,8 @@
|
||||
package grpcproxy
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
||||
"github.com/coreos/etcd/mvcc"
|
||||
@ -86,7 +88,9 @@ func (w *watcher) send(wr clientv3.WatchResponse) {
|
||||
}
|
||||
select {
|
||||
case w.ch <- pbwr:
|
||||
default:
|
||||
panic("handle this")
|
||||
case <-time.After(50 * time.Millisecond):
|
||||
// close the watch chan will notify the stream sender.
|
||||
// the stream will gc all its watchers.
|
||||
close(w.ch)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user