Skip to content

Commit 430358d

Browse files
committed
EVCACHE-454: Ideally, app should not serve traffic until it is healthy but this option - ignoreAppEurekaStatus will allow app to ignore application eureka status while trying to initialize evcache client. This feature may be required for applications which are behind load balancers. They may fail to register successfully with eureka but are still expected to serve traffic.
1 parent b8ab182 commit 430358d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

evcache-client/src/main/java/com/netflix/evcache/pool/eureka/EurekaNodeListProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ public EurekaNodeListProvider(ApplicationInfoManager applicationInfoManager, Eur
5656
*/
5757
@Override
5858
public Map<ServerGroup, EVCacheServerGroupConfig> discoverInstances(String _appName) throws IOException {
59-
if ((applicationInfoManager.getInfo().getStatus() == InstanceStatus.DOWN)) {
59+
final Property<Boolean> ignoreAppEurekaStatus = props.get("evcache.ignoreAppEurekaStatus", Boolean.class).orElse(false);
60+
61+
if (ignoreAppEurekaStatus.get())
62+
log.info("Not going to consider the eureka status of the application, to initialize evcache client.");
63+
64+
if (!ignoreAppEurekaStatus.get() && (applicationInfoManager.getInfo().getStatus() == InstanceStatus.DOWN)) {
65+
log.info("Not initializing evcache client as application eureka status is DOWN. " +
66+
"One can override this behavior by setting evcache.ignoreAppEurekaStatus property to true, scoped to your application.");
6067
return Collections.<ServerGroup, EVCacheServerGroupConfig> emptyMap();
6168
}
6269

0 commit comments

Comments
 (0)