diff --git a/examples/echo_bench/echo_bench.go b/examples/echo_bench/echo_bench.go index 93f4fc1..3c6ff1d 100644 --- a/examples/echo_bench/echo_bench.go +++ b/examples/echo_bench/echo_bench.go @@ -62,17 +62,21 @@ func main() { rx.OnNext(func(input payload.Payload) error { //m2, _ := elem.MetadataUTF8() //assert.Equal(t, m1, m2, "metadata doesn't match") - wg.Done() return nil }), rx.OnError(func(e error) { - wg.Done() errCount.Inc() + wg.Done() + }), + rx.OnComplete(func() { + wg.Done() }), ) request := payload.New(data, nil) for i := 0; i < n; i++ { - client.RequestResponse(request).SubscribeOn(scheduler.Elastic()).SubscribeWith(context.Background(), sub) + client.RequestResponse(request). + SubscribeOn(scheduler.Elastic()). + SubscribeWith(context.Background(), sub) } wg.Wait() cost := time.Since(now) diff --git a/go.mod b/go.mod index 3ee87b7..db2eae7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golang/mock v1.4.3 github.com/google/uuid v1.1.2 github.com/gorilla/websocket v1.4.2 - github.com/jjeffcaii/reactor-go v0.3.4 + github.com/jjeffcaii/reactor-go v0.3.5 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.6.1 github.com/urfave/cli/v2 v2.1.1 diff --git a/go.sum b/go.sum index d877fe1..8de338e 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/jjeffcaii/reactor-go v0.3.4 h1:Ksq4rEmW9/rxvyoDBtptjoSyOLUUSNmAw3SdUbeWlDs= -github.com/jjeffcaii/reactor-go v0.3.4/go.mod h1:w5NNtYKACJocob2sc18oPf1F0/NJBhWITZcfcEoyZOQ= +github.com/jjeffcaii/reactor-go v0.3.5 h1:JRTfcG8LiTO23VyB3+ftGgzhgsi/ktj9nM1kpYUrZXw= +github.com/jjeffcaii/reactor-go v0.3.5/go.mod h1:w5NNtYKACJocob2sc18oPf1F0/NJBhWITZcfcEoyZOQ= github.com/panjf2000/ants/v2 v2.4.2 h1:kesjjo8JipN3vNNg1XaiXaeSs6xJweBTgenkBtsrHf8= github.com/panjf2000/ants/v2 v2.4.2/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=