Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more logging #1047

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions actor/future_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
11 changes: 0 additions & 11 deletions actor/mailbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions remote/endpoint_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}()

Expand Down Expand Up @@ -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:
Expand Down
Loading