fix HostFilterPolicy
The outer policy should filter on the way in or the way out, not both.
This commit is contained in:
		@@ -504,19 +504,15 @@ class HostFilterPolicy(LoadBalancingPolicy):
 | 
			
		||||
        self._predicate = predicate
 | 
			
		||||
 | 
			
		||||
    def on_up(self, host, *args, **kwargs):
 | 
			
		||||
        if self.predicate(host):
 | 
			
		||||
        return self._child_policy.on_up(host, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    def on_down(self, host, *args, **kwargs):
 | 
			
		||||
        if self.predicate(host):
 | 
			
		||||
        return self._child_policy.on_down(host, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    def on_add(self, host, *args, **kwargs):
 | 
			
		||||
        if self.predicate(host):
 | 
			
		||||
        return self._child_policy.on_add(host, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    def on_remove(self, host, *args, **kwargs):
 | 
			
		||||
        if self.predicate(host):
 | 
			
		||||
        return self._child_policy.on_remove(host, *args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
@@ -545,10 +541,7 @@ class HostFilterPolicy(LoadBalancingPolicy):
 | 
			
		||||
            return HostDistance.IGNORED
 | 
			
		||||
 | 
			
		||||
    def populate(self, cluster, hosts):
 | 
			
		||||
        self._child_policy.populate(
 | 
			
		||||
            cluster=cluster,
 | 
			
		||||
            hosts=[h for h in hosts if self.predicate(h)]
 | 
			
		||||
        )
 | 
			
		||||
        self._child_policy.populate(cluster=cluster, hosts=hosts)
 | 
			
		||||
 | 
			
		||||
    def make_query_plan(self, working_keyspace=None, query=None):
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user