Skip to content

Commit

Permalink
minor revise lambda rpc func
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Apr 15, 2021
1 parent 040d43c commit 1f93621
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions rpc/rpc.go
Expand Up @@ -807,7 +807,7 @@ func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error {
}

if RunAndWaitOptions.DeployOptions == nil {
return types.ErrNoDeployOpts
return grpcstatus.Error(RunAndWait, types.ErrNoDeployOpts.Error())
}

opts := RunAndWaitOptions.DeployOptions
Expand All @@ -833,21 +833,22 @@ func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error {
inCh := make(chan []byte)
go func() {
defer close(inCh)
if opts.OpenStdin {
for {
RunAndWaitOptions, err := stream.Recv()
if RunAndWaitOptions == nil || err != nil {
log.Errorf("[RunAndWait] Recv command error: %v", err)
break
}
inCh <- RunAndWaitOptions.Cmd
if !opts.OpenStdin {
return
}
for {
RunAndWaitOptions, err := stream.Recv()
if RunAndWaitOptions == nil || err != nil {
log.Errorf("[RunAndWait] Recv command error: %v", err)
break
}
inCh <- RunAndWaitOptions.Cmd
}
}()

ids, ch, err := v.cluster.RunAndWait(ctx, deployOpts, inCh)
if err != nil {
return err
return grpcstatus.Error(RunAndWait, err.Error())
}

// send workload ids to client first
Expand Down

0 comments on commit 1f93621

Please sign in to comment.