Skip to content

Commit

Permalink
Merge pull request #1047 from asynkron/more-logging-remote
Browse files Browse the repository at this point in the history
more logging
  • Loading branch information
rogeralsing authored Apr 5, 2024
2 parents 769d317 + 967933a commit 98b5bb6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
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

0 comments on commit 98b5bb6

Please sign in to comment.