|
|
@ -175,7 +175,9 @@ func (s *Service) UpdateTask( |
|
|
|
ctx context.Context, |
|
|
|
ctx context.Context, |
|
|
|
req *connect.Request[runnerv1.UpdateTaskRequest], |
|
|
|
req *connect.Request[runnerv1.UpdateTaskRequest], |
|
|
|
) (*connect.Response[runnerv1.UpdateTaskResponse], error) { |
|
|
|
) (*connect.Response[runnerv1.UpdateTaskResponse], error) { |
|
|
|
task, err := actions_model.UpdateTaskByState(ctx, req.Msg.State) |
|
|
|
runner := GetRunner(ctx) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
task, err := actions_model.UpdateTaskByState(ctx, runner.ID, req.Msg.State) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, status.Errorf(codes.Internal, "update task: %v", err) |
|
|
|
return nil, status.Errorf(codes.Internal, "update task: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
@ -237,11 +239,15 @@ func (s *Service) UpdateLog( |
|
|
|
ctx context.Context, |
|
|
|
ctx context.Context, |
|
|
|
req *connect.Request[runnerv1.UpdateLogRequest], |
|
|
|
req *connect.Request[runnerv1.UpdateLogRequest], |
|
|
|
) (*connect.Response[runnerv1.UpdateLogResponse], error) { |
|
|
|
) (*connect.Response[runnerv1.UpdateLogResponse], error) { |
|
|
|
|
|
|
|
runner := GetRunner(ctx) |
|
|
|
|
|
|
|
|
|
|
|
res := connect.NewResponse(&runnerv1.UpdateLogResponse{}) |
|
|
|
res := connect.NewResponse(&runnerv1.UpdateLogResponse{}) |
|
|
|
|
|
|
|
|
|
|
|
task, err := actions_model.GetTaskByID(ctx, req.Msg.TaskId) |
|
|
|
task, err := actions_model.GetTaskByID(ctx, req.Msg.TaskId) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, status.Errorf(codes.Internal, "get task: %v", err) |
|
|
|
return nil, status.Errorf(codes.Internal, "get task: %v", err) |
|
|
|
|
|
|
|
} else if runner.ID != task.RunnerID { |
|
|
|
|
|
|
|
return nil, status.Errorf(codes.Internal, "invalid runner for task") |
|
|
|
} |
|
|
|
} |
|
|
|
ack := task.LogLength |
|
|
|
ack := task.LogLength |
|
|
|
|
|
|
|
|
|
|
|