(ctx context.Context, req *proto.DeleteConversationRequest)
| 106 | } |
| 107 | |
| 108 | func (s *Server) DeleteConversation(ctx context.Context, req *proto.DeleteConversationRequest) (*proto.DeleteConversationResponse, error) { |
| 109 | slog.InfoContext(ctx, "Deleting conversation...", |
| 110 | slog.String("conversation_id", req.ConversationId)) |
| 111 | |
| 112 | if req.ConversationId == "" { |
| 113 | return nil, status.Errorf(codes.InvalidArgument, "conversation_id is required") |
| 114 | } |
| 115 | inFlight, cleanup := s.markInFlight(req.ConversationId) |
| 116 | if inFlight { |
| 117 | return nil, status.Errorf(codes.FailedPrecondition, "conversation %q is already in flight", req.ConversationId) |
| 118 | } |
| 119 | defer cleanup() |
| 120 | |
| 121 | if err := s.controller.Delete(ctx, req.ConversationId); err != nil { |
| 122 | return nil, status.Errorf(codes.Internal, "failed to delete conversation: %v", err) |
| 123 | } |
| 124 | go suspendActor(req.ConversationId) // TODO(jbd): Move to an interceptor. |
| 125 | return &proto.DeleteConversationResponse{}, nil |
| 126 | } |
| 127 | |
| 128 | // Serve starts the gRPC server on the specified address. |
| 129 | func (s *Server) Serve(address string, opts ...grpc.ServerOption) error { |
nothing calls this directly
no test coverage detected