Skip to content

Commit

Permalink
0003623: Fix unintended side-effects involving push/pull node lists
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichalek committed Jul 10, 2018
1 parent 2b421b5 commit 48139ad
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -389,13 +389,14 @@ public List<Node> findTargetNodesFor(NodeGroupLinkAction eventAction) {
long cacheTimeoutInMs = parameterService.getLong(ParameterConstants.CACHE_TIMEOUT_NODE_GROUP_LINK_IN_MS);
if (node != null) {
List<Node> list = targetNodesCache.get(eventAction.name());

if (list == null || (System.currentTimeMillis() - targetNodeLinkCacheTime.get(eventAction.toString())) >= cacheTimeoutInMs) {
list = sqlTemplate.query(getSql("selectNodePrefixSql", "findNodesWhoITargetSql"),
new NodeRowMapper(), node.getNodeGroupId(), eventAction.name());
targetNodesCache.put(eventAction.name(), list);
targetNodeLinkCacheTime.put(eventAction.toString(),System.currentTimeMillis());
}
return list;
return new ArrayList<Node>(list);
} else {
return Collections.emptyList();
}
Expand Down

0 comments on commit 48139ad

Please sign in to comment.