mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 06:54:41 +00:00
nope
This commit is contained in:
@@ -131,10 +131,14 @@ func (s *Server) BufferCapacity() int {
|
||||
return s.cmdsCap
|
||||
}
|
||||
|
||||
// Subscribe creates a subscription for the given client. An error will be
|
||||
// returned to the caller if the context is canceled or if subscription already
|
||||
// exist for pair clientID and query. outCapacity can be used to set a
|
||||
// capacity for Subscription#Out channel (1 by default).
|
||||
// Subscribe creates a subscription for the given client.
|
||||
//
|
||||
// An error will be returned to the caller if the context is canceled or if
|
||||
// subscription already exist for pair clientID and query.
|
||||
//
|
||||
// outCapacity can be used to set a capacity for Subscription#Out channel (1 by
|
||||
// default). Panics if outCapacity is less than or equal to zero. If you want
|
||||
// an unbuffered channel, use SubscribeUnbuffered.
|
||||
func (s *Server) Subscribe(ctx context.Context, clientID string, query Query, outCapacity ...int) (*Subscription, error) {
|
||||
outCap := 1
|
||||
if len(outCapacity) > 0 {
|
||||
|
||||
@@ -306,7 +306,7 @@ func benchmarkNClientsOneQuery(n int, b *testing.B) {
|
||||
func assertReceive(t *testing.T, expected interface{}, ch <-chan pubsub.MsgAndTags, msgAndArgs ...interface{}) {
|
||||
select {
|
||||
case actual := <-ch:
|
||||
assert.Equal(t, expected, actual.Msg, msgAndArgs...)
|
||||
assert.Equal(t, expected, actual.Msg(), msgAndArgs...)
|
||||
case <-time.After(1 * time.Second):
|
||||
t.Errorf("Expected to receive %v from the channel, got nothing after 1s", expected)
|
||||
debug.PrintStack()
|
||||
|
||||
@@ -55,6 +55,16 @@ func (s *Subscription) Err() error {
|
||||
|
||||
// MsgAndTags glues a message and tags together.
|
||||
type MsgAndTags struct {
|
||||
Msg interface{}
|
||||
Tags TagMap
|
||||
msg interface{}
|
||||
tags TagMap
|
||||
}
|
||||
|
||||
// Msg returns a message.
|
||||
func (mt MsgAndTags) Msg() interface{} {
|
||||
return mt.msg
|
||||
}
|
||||
|
||||
// Tags returns tags.
|
||||
func (mt MsgAndTags) Tags() TagMap {
|
||||
return mt.tags
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user