change Subscribe#out cap to 1

and replace config vars with RPCConfig
This commit is contained in:
Anton Kaliaev
2019-02-28 16:51:29 +03:00
parent ee8884b24f
commit f45b01aeff
6 changed files with 38 additions and 29 deletions

View File

@ -295,7 +295,9 @@ func (w *WSEvents) OnStop() {
}
// Subscribe implements EventsClient by using WSClient to subscribe given
// subscriber to query.
// subscriber to query. By default, returns a channel with cap=1. Error is
// returned if it fails to subscribe.
// Channel is never closed to prevent clients from seeing an erroneus event.
func (w *WSEvents) Subscribe(ctx context.Context, subscriber, query string,
outCapacity ...int) (out <-chan ctypes.ResultEvent, err error) {
@ -303,7 +305,7 @@ func (w *WSEvents) Subscribe(ctx context.Context, subscriber, query string,
return nil, err
}
outCap := 0
outCap := 1
if len(outCapacity) > 0 {
outCap = outCapacity[0]
}