Spot the bug in the gRPC handler

from gRPC
Go 1.27 / gRPC-Go 1.83.2 intermediate 4 min 1 issue to find

Find the cancellation bug in this generated handler.

Go
func (s *server) Reserve(ctx context.Context, req *pb.ReserveRequest) (*pb.ReserveResponse, error) {
    stock, err := s.inventory.GetStock(
        context.Background(),
        &inventorypb.GetStockRequest{Sku: req.Sku},
    )
    if err != nil {
        return nil, err
    }
    return s.commit(ctx, req, stock)
}
Open in playground
Report an error