Skip to content

Commit

Permalink
fix: use different listener ID to better identify stuck channel
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <[email protected]>
  • Loading branch information
gfanton committed Nov 20, 2023
1 parent 1126d9f commit d6acd41
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tm2/pkg/bft/consensus/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package consensus
import (
"bytes"
"fmt"
"reflect"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -1779,6 +1781,11 @@ func TestStateOutputVoteStats(t *testing.T) {
}
}

var eventid uint32

func subscribe(evsw events.EventSwitch, protoevent events.Event) <-chan events.Event {
return events.SubscribeToEvent(evsw, testSubscriber, protoevent)
name := reflect.ValueOf(protoevent).Type().Name()
id := atomic.AddUint32(&eventid, 1)
listenerID := fmt.Sprintf("%s-%s-%d", testSubscriber, name, id)
return events.SubscribeToEvent(evsw, listenerID, protoevent)
}

0 comments on commit d6acd41

Please sign in to comment.