Skip to content

Commit

Permalink
[#4520]ratioCeiling defaults to 100-ratio (#4523)
Browse files Browse the repository at this point in the history
  • Loading branch information
liubao68 authored Sep 14, 2024
1 parent ec699f0 commit ce3cf0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ private int getRatio() {
.getIntProperty(CONFIG_RATIO, 30).get();
}

private int getRatioCeiling() {
private int getRatioCeiling(int defaultValue) {
return DynamicPropertyFactory.getInstance()
.getIntProperty(CONFIG_RATIO_CEILING, 70).get();
.getIntProperty(CONFIG_RATIO_CEILING, defaultValue).get();
}

@Override
Expand All @@ -74,7 +74,7 @@ public List<ServiceCombServer> getFilteredListOfServers(List<ServiceCombServer>
});

int ratio = getRatio();
int ratioCeiling = getRatioCeiling();
int ratioCeiling = getRatioCeiling(100 - ratio);

if (hasEnoughMembers(servers.size(), instancesRegionAndAZMatch.size(), ratio, ratioCeiling)) {
return instancesRegionAndAZMatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void tearDown() {
@Test
public void test_not_enough_instance() {
ArchaiusUtils.setProperty(ZoneAwareDiscoveryFilter.CONFIG_RATIO, 50);
ArchaiusUtils.setProperty(ZoneAwareDiscoveryFilter.CONFIG_RATIO_CEILING, 70);
ZoneAwareDiscoveryFilter filter = new ZoneAwareDiscoveryFilter();

// set up data
Expand Down

0 comments on commit ce3cf0a

Please sign in to comment.