Browse Source

no timeout

pull/3227/head
Anton Kaliaev 6 years ago
parent
commit
cf67a8b1b7
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 4 additions and 4 deletions
  1. +1
    -2
      libs/pubsub/pubsub.go
  2. +3
    -2
      types/event_bus_test.go

+ 1
- 2
libs/pubsub/pubsub.go View File

@ -38,7 +38,6 @@ import (
"context" "context"
"errors" "errors"
"sync" "sync"
"time"
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
) )
@ -395,7 +394,7 @@ func (state *state) send(msg interface{}, tags map[string]string) {
// don't block on buffered channels // don't block on buffered channels
select { select {
case subscription.out <- Message{msg, tags}: case subscription.out <- Message{msg, tags}:
case <-time.After(100 * time.Millisecond):
default:
state.remove(clientID, qStr, ErrOutOfCapacity) state.remove(clientID, qStr, ErrOutOfCapacity)
} }
} }


+ 3
- 2
types/event_bus_test.go View File

@ -139,10 +139,11 @@ func TestEventBusPublish(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer eventBus.Stop() defer eventBus.Stop()
sub, err := eventBus.Subscribe(context.Background(), "test", tmquery.Empty{})
const numEventsExpected = 14
sub, err := eventBus.Subscribe(context.Background(), "test", tmquery.Empty{}, numEventsExpected)
require.NoError(t, err) require.NoError(t, err)
const numEventsExpected = 14
done := make(chan struct{}) done := make(chan struct{})
go func() { go func() {
numEvents := 0 numEvents := 0


Loading…
Cancel
Save