fix migration rule ip match logic

This commit is contained in:
ken.lj 2020-11-10 10:38:04 +08:00
parent ca2d24f49e
commit 03abe135dc
1 changed files with 5 additions and 5 deletions

View File

@ -57,13 +57,13 @@ public class MigrationRuleHandler<T> {
try {
rule = MigrationRule.parse(rawRule);
// FIXME, consumerURL.getHost() might not exactly the ip expected.
if (rule.getTargetIps() == null || !rule.getTargetIps().contains(consumerURL.getHost())) {
if (rule.getTargetIps() != null && rule.getTargetIps().contains(consumerURL.getHost())) {
setMigrationRule(rule);
step = rule.getStep(consumerURL.getServiceKey());
threshold = rule.getThreshold(consumerURL.getServiceKey());
} else {
logger.info("Migration rule ignored, rule target ips " + rule.getTargetIps() + " and local ip " + consumerURL.getHost() + " do not match");
return;
}
setMigrationRule(rule);
step = rule.getStep(consumerURL.getServiceKey());
threshold = rule.getThreshold(consumerURL.getServiceKey());
} catch (Exception e) {
logger.error("Parse migration rule error, will use default step " + step, e);
}