Skip to content

Commit

Permalink
fix benchmark panics due to changed writer behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Jan 11, 2023
1 parent fbf0145 commit 40de54d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func newTestConnectedClientV2(t *testing.T, n *Node, userID string) *Client {
return client
}

func newTestConnectedClientWithTransport(t *testing.T, ctx context.Context, n *Node, transport Transport, userID string) *Client {
func newTestConnectedClientWithTransport(t testing.TB, ctx context.Context, n *Node, transport Transport, userID string) *Client {
client := newTestClientCustomTransport(t, ctx, n, transport, userID)
if transport.ProtocolVersion() == ProtocolVersion1 {
connectClient(t, client)
Expand Down
6 changes: 2 additions & 4 deletions hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,7 @@ func BenchmarkHub_Contention(b *testing.B) {
}

for i := 0; i < numClients; i++ {
c, err := newClient(context.Background(), n, newTestTransport(func() {}))
require.NoError(b, err)
c := newTestConnectedClientWithTransport(b, context.Background(), n, newTestTransport(func() {}), "12")
_ = n.hub.add(c)
clients = append(clients, c)
for _, ch := range channels {
Expand Down Expand Up @@ -796,8 +795,7 @@ func BenchmarkHub_MassiveBroadcast(b *testing.B) {
for i := 0; i < numSubscribers; i++ {
t := newTestTransport(func() {})
t.setSink(sink)
c, err := newClient(context.Background(), n, t)
require.NoError(b, err)
c := newTestConnectedClientWithTransport(b, context.Background(), n, t, "12")
_ = n.hub.add(c)
for _, ch := range channels {
_, _ = n.hub.addSub(ch, c)
Expand Down

0 comments on commit 40de54d

Please sign in to comment.