Skip to content

Commit

Permalink
refactor: enhance stop computation
Browse files Browse the repository at this point in the history
Signed-off-by: WashingtonKK <[email protected]>
  • Loading branch information
WashingtonKK committed Aug 22, 2024
1 parent f819902 commit a558da2
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 163 deletions.
14 changes: 0 additions & 14 deletions manager/api/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,8 @@ func (client ManagerClient) Process(ctx context.Context, cancel context.CancelFu
ComputationId: mes.StopComputation.ComputationId,
}}
if err := client.svc.Stop(ctx, mes.StopComputation.ComputationId); err != nil {
if errors.Contains(err, manager.ErrNotFound) {
msg.StopComputationRes.Message = err.Error()
msg.StopComputationRes.Stopped = false
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
return err
}
return nil
}
msg.StopComputationRes.Message = err.Error()
msg.StopComputationRes.Stopped = false
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
return err
}
return err
}
msg.StopComputationRes.Stopped = true
if err := client.stream.Send(&pkgmanager.ClientStreamMessage{Message: msg}); err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions manager/manager.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ message StopComputation {

message StopComputationResponse {
string computation_id = 1;
bool stopped = 2;
string message = 3;
string message = 2;
}

message RunResponse{
Expand Down
Loading

0 comments on commit a558da2

Please sign in to comment.