#1873, set default server expire timeout to 10 seconds and configurable.

This commit is contained in:
nkorange 2019-09-25 16:15:31 +08:00
parent 6b7b894a0d
commit f0c19859ce
4 changed files with 10 additions and 4 deletions

View File

@ -73,7 +73,7 @@ public class ServerListManager {
@PostConstruct
public void init() {
GlobalExecutor.registerServerListUpdater(new ServerListUpdater());
GlobalExecutor.registerServerStatusReporter(new ServerStatusReporter(), 5000);
GlobalExecutor.registerServerStatusReporter(new ServerStatusReporter(), 2000);
}
private List<Server> refreshServerList() {

View File

@ -58,7 +58,7 @@ public class SwitchDomain implements Record, Cloneable {
private List<String> incrementalList = new ArrayList<>();
private long serverStatusSynchronizationPeriodMillis = TimeUnit.SECONDS.toMillis(15);
private long serverStatusSynchronizationPeriodMillis = TimeUnit.SECONDS.toMillis(2);
private long serviceStatusSynchronizationPeriodMillis = TimeUnit.SECONDS.toMillis(5);
@ -71,7 +71,7 @@ public class SwitchDomain implements Record, Cloneable {
/**
* The server is regarded as expired if its two reporting interval is lagger than this variable.
*/
private long distroServerExpiredMillis = TimeUnit.SECONDS.toMillis(30);
private long distroServerExpiredMillis = TimeUnit.SECONDS.toMillis(10);
/**
* since which version, push can be enabled

View File

@ -46,7 +46,7 @@ public class SwitchEntry {
public static final int MIN_PUSH_CACHE_TIME_MIILIS = 10000;
public static final int MIN_CACHE_TIME_MIILIS = 1000;
public static final int MIN_SERVICE_SYNC_TIME_MIILIS = 5000;
public static final int MIN_SERVER_SYNC_TIME_MIILIS = 15000;
public static final int MIN_SERVER_SYNC_TIME_MIILIS = 1000;
public static final String ACTION_ADD = "add";
public static final String ACTION_REPLACE = "replace";
@ -60,4 +60,5 @@ public class SwitchEntry {
public static final String OVERRIDDEN_SERVER_STATUS = "overriddenServerStatus";
public static final String DEFAULT_INSTANCE_EPHEMERAL = "defaultInstanceEphemeral";
public static final String DISTRO_SERVER_EXPIRED_MILLIS = "distroServerExpiredMillis";
}

View File

@ -267,6 +267,11 @@ public class SwitchManager implements RecordListener<SwitchDomain> {
switchDomain.setDefaultInstanceEphemeral(Boolean.parseBoolean(defaultEphemeral));
}
if (entry.equals(SwitchEntry.DISTRO_SERVER_EXPIRED_MILLIS)) {
String distroServerExpiredMillis = value;
switchDomain.setDistroServerExpiredMillis(Long.parseLong(distroServerExpiredMillis));
}
if (debug) {
update(switchDomain);
} else {