mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-23 15:41:30 +00:00
rpc: pass outCapacity to eventBus#Subscribe when subscribing using a l… (#4279)
* pass `outCapacity` to `eventBus#Subscribe` when subscribing using a local client Fixes #4256 * use outCap directly
This commit is contained in:
@@ -142,3 +142,4 @@ program](https://hackerone.com/tendermint).
|
||||
efforts of @gchaincl and @ancazamfir)
|
||||
- [p2p] \#4140 `SecretConnection`: use the transcript solely for authentication (i.e. MAC)
|
||||
- [consensus/types] \#4243 fix BenchmarkRoundStateDeepCopy panics (@cuonglm)
|
||||
- [rpc] \#4256 Pass `outCapacity` to `eventBus#Subscribe` when subscribing using a local client
|
||||
|
||||
@@ -177,16 +177,22 @@ func (c *Local) Subscribe(
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to parse query")
|
||||
}
|
||||
sub, err := c.EventBus.Subscribe(ctx, subscriber, q)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to subscribe")
|
||||
}
|
||||
|
||||
outCap := 1
|
||||
if len(outCapacity) > 0 {
|
||||
outCap = outCapacity[0]
|
||||
}
|
||||
|
||||
var sub types.Subscription
|
||||
if outCap > 0 {
|
||||
sub, err = c.EventBus.Subscribe(ctx, subscriber, q, outCap)
|
||||
} else {
|
||||
sub, err = c.EventBus.SubscribeUnbuffered(ctx, subscriber, q)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to subscribe")
|
||||
}
|
||||
|
||||
outc := make(chan ctypes.ResultEvent, outCap)
|
||||
go c.eventsRoutine(sub, subscriber, q, outc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user