fixup! wip: refactor: API
This commit is contained in:
parent
f006187894
commit
7d6798b0f7
@ -63,9 +63,9 @@ func (a *App) Run(ctx context.Context) error {
|
||||
ui, err := terminal.NewUI(ctx, terminal.Params{
|
||||
EventBus: a.bus,
|
||||
Dispatcher: func(cmd event.Command) {
|
||||
a.logger.Info("Command dispatched", "cmd", cmd.Name())
|
||||
a.logger.Debug("Command dispatched to gRPC stream", "cmd", cmd.Name())
|
||||
if sendErr := stream.Send(&pb.Envelope{Payload: &pb.Envelope_Command{Command: protocol.CommandToProto(cmd)}}); sendErr != nil {
|
||||
a.logger.Error("Error sending command to gRPC API", "err", sendErr)
|
||||
a.logger.Error("Error dispatching command to gRPC stream", "err", sendErr)
|
||||
}
|
||||
},
|
||||
ClipboardAvailable: a.clipboardAvailable,
|
||||
|
@ -109,7 +109,7 @@ func (s *Server) Communicate(stream pb.InternalAPI_CommunicateServer) error {
|
||||
switch pbCmd := in.Payload.(type) {
|
||||
case *pb.Envelope_Command:
|
||||
cmd := protocol.CommandFromProto(pbCmd.Command)
|
||||
s.logger.Info("Received command", "command", cmd.Name())
|
||||
s.logger.Debug("Received command from gRPC stream", "command", cmd.Name())
|
||||
s.dispatcher(cmd)
|
||||
default:
|
||||
return fmt.Errorf("expected command but got: %T", pbCmd)
|
||||
|
@ -265,7 +265,7 @@ func (a *App) handleCommand(
|
||||
containerClient *container.Client,
|
||||
startMediaServerC chan struct{},
|
||||
) (evt event.Event, _ error) {
|
||||
a.logger.Debug("Command received", "cmd", cmd.Name())
|
||||
a.logger.Debug("Command received in handler", "cmd", cmd.Name())
|
||||
defer func() {
|
||||
if evt != nil {
|
||||
a.eventBus.Send(evt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user