diff --git a/actor/future_test.go b/actor/future_test.go index e58da238..542da33f 100644 --- a/actor/future_test.go +++ b/actor/future_test.go @@ -117,3 +117,20 @@ func TestFuture_Result_Success(t *testing.T) { resp := assertFutureSuccess(future, t) a.Equal(EchoResponse{}, resp) } + +func testWork(ctx Context) { + if _, ok := ctx.Message().(string); ok { + ctx.Respond("pong") + } +} + +func BenchmarkProto(b *testing.B) { + system := NewActorSystem() + pid := system.Root.Spawn(PropsFromFunc(testWork)) + for i := 0; i < b.N; i++ { + _, err := system.Root.RequestFuture(pid, "ping", time.Second).Result() + if err != nil { + panic(err) + } + } +} diff --git a/actor/mailbox.go b/actor/mailbox.go index 1ada8207..f4294e89 100644 --- a/actor/mailbox.go +++ b/actor/mailbox.go @@ -61,17 +61,6 @@ func (m *defaultMailbox) PostUserMessage(message interface{}) { } } - // is it an envelope batch message? - // FIXME: check if this is still needed, maybe MessageEnvelope can only exist as a pointer - if env, ok := message.(MessageEnvelope); ok { - if batch, ok := env.Message.(MessageBatch); ok { - messages := batch.GetMessages() - - for _, msg := range messages { - m.PostUserMessage(msg) - } - } - } if env, ok := message.(*MessageEnvelope); ok { if batch, ok := env.Message.(MessageBatch); ok { messages := batch.GetMessages() diff --git a/remote/endpoint_reader.go b/remote/endpoint_reader.go index ec3e1d97..fd28800e 100644 --- a/remote/endpoint_reader.go +++ b/remote/endpoint_reader.go @@ -39,6 +39,7 @@ func (s *endpointReader) Receive(stream Remoting_ReceiveServer) error { disconnectChan := make(chan bool, 1) s.remote.edpManager.endpointReaderConnections.Store(stream, disconnectChan) defer func() { + s.remote.Logger().Info("EndpointReader is closing") close(disconnectChan) }() @@ -88,6 +89,7 @@ func (s *endpointReader) Receive(stream Remoting_ReceiveServer) error { m := t.MessageBatch err := s.onMessageBatch(m) if err != nil { + s.remote.Logger().Error("EndpointReader failed to handle message batch", slog.Any("error", err)) return err } default: