Browse Source

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
pull/4282/head
Anton Kaliaev 5 years ago
committed by GitHub
parent
commit
7f655d8e9e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +10
    -4
      rpc/client/localclient.go

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -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

+ 10
- 4
rpc/client/localclient.go View File

@ -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)


Loading…
Cancel
Save