Skip to content

Commit e9bfdbf

Browse files
committed
cleanup: remove unused enum
add constant for VALID_LOADBALANCING_ALGORITHMS
1 parent f81a62a commit e9bfdbf

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

app/messages/manifest_routes_update_message.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def contains_invalid_lb_algo?(routes)
4343
routes.any? do |r|
4444
next unless r[:options] && r[:options][:'loadbalancing-algorithm']
4545

46-
return true if r[:options][:'loadbalancing-algorithm'] && %w[round-robin least-connections].exclude?(r[:options][:'loadbalancing-algorithm'])
46+
return true if r[:options][:'loadbalancing-algorithm'] && RouteOptionsMessage::VALID_LOADBALANCING_ALGORITHMS.exclude?(r[:options][:'loadbalancing-algorithm'])
4747
end
4848
end
4949
end

app/messages/route_options_message.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
module VCAP::CloudController
44
class RouteOptionsMessage < BaseMessage
5+
6+
VALID_LOADBALANCING_ALGORITHMS = %w[round-robin least-connections].freeze
7+
58
register_allowed_keys %i[lb_algo]
69
validates_with NoAdditionalKeysValidator
710
validates :lb_algo,
8-
inclusion: { in: %w[least-connections round-robin], message: "'%<value>s' is not a supported load-balancing algorithm" },
11+
inclusion: { in: VALID_LOADBALANCING_ALGORITHMS, message: "'%<value>s' is not a supported load-balancing algorithm" },
912
presence: true,
1013
allow_nil: true
1114
end

app/models/runtime/route.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66

77
module VCAP::CloudController
88

9-
class LBAlgorithmEnum
10-
ROUND_ROBIN = 'round-robin'.freeze
11-
LEAST_CONNECTION = 'least-connection'.freeze
12-
end
13-
149
class Route < Sequel::Model
1510
class InvalidOrganizationRelation < CloudController::Errors::InvalidRelation; end
1611

0 commit comments

Comments
 (0)