Попробуйте:
myService.ribbon.ServerListRefreshInterval=10000
где myService
- имя целевого микросервиса.
ОБНОВЛЕНИЕ:
Покопавшись в исходном коде, я обнаружил, что LoadBalancerBuilder
вызывает:
@Deprecated
public ZoneAwareLoadBalancer(IClientConfig clientConfig, IRule rule,
IPing ping, ServerList<T> serverList, ServerListFilter<T> filter) {
super(clientConfig, rule, ping, serverList, filter);
}
чей супер:
@Deprecated
public DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping,
ServerList<T> serverList, ServerListFilter<T> filter) {
this(
clientConfig,
rule,
ping,
serverList,
filter,
new PollingServerListUpdater()
);
}
Обратите внимание на конструкторы PollingServerListUpdater
:
private static int LISTOFSERVERS_CACHE_REPEAT_INTERVAL = 30 * 1000; // msecs;
public PollingServerListUpdater() {
this(LISTOFSERVERS_CACHE_UPDATE_DELAY, LISTOFSERVERS_CACHE_REPEAT_INTERVAL);
}
public PollingServerListUpdater(IClientConfig clientConfig) {
this(LISTOFSERVERS_CACHE_UPDATE_DELAY, getRefreshIntervalMs(clientConfig));
}
Второй позволит нам переопределить интервал обновления по умолчанию. Однако он вызывается первым, поэтому он игнорирует свойство.
ОБНОВЛЕНИЕ 2:
По этому поводу есть открытый вопрос: https://github.com/spring-cloud/spring-cloud-netflix/issues/1304
person
codependent
schedule
19.09.2016