@@ -491,11 +491,20 @@ func (p *EndpointPool) Endpoints(logger *slog.Logger, initial string, mustBeStic
491491 }
492492}
493493
494- func (p * EndpointPool ) FallBackToDefaultLoadBalancing (logger * slog.Logger , initial string , mustBeSticky bool , azPreference string , az string ) EndpointIterator {
494+ func (p * EndpointPool ) FallBackToDefaultLoadBalancing (defaultLBAlgo string , logger * slog.Logger , initial string , mustBeSticky bool , azPreference string , az string ) EndpointIterator {
495495 logger .Info ("hash-based-routing-header-not-found" ,
496496 slog .String ("poolLBAlgorithm" , p .LoadBalancingAlgorithm ),
497497 slog .String ("Host" , p .host ),
498498 slog .String ("Path" , p .contextPath ))
499+
500+ switch defaultLBAlgo {
501+ case config .LOAD_BALANCE_LC :
502+ logger .Debug ("endpoint-iterator-with-least-connection-lb-algo" )
503+ return NewLeastConnection (logger , p , initial , mustBeSticky , azPreference == config .AZ_PREF_LOCAL , az )
504+ case config .LOAD_BALANCE_RR :
505+ logger .Debug ("endpoint-iterator-with-round-robin-lb-algo" )
506+ return NewRoundRobin (logger , p , initial , mustBeSticky , azPreference == config .AZ_PREF_LOCAL , az )
507+ }
499508 return NewRoundRobin (logger , p , initial , mustBeSticky , azPreference == config .AZ_PREF_LOCAL , az )
500509}
501510
0 commit comments