Do not cache TaskTree ChangeNodes

Since these nodes are unlikely to be the used more than once
in a real world situation, do not waste memory caching these
nodes.

Before this change, a task.config which walks all dependencies for a
change would not complete after an hour when run with status:open
--no-limit. At the time of attempting to run the query, it is visible
that lots of CPU is being spent using top, more than a 1000%, likely for
java GC. After this change it completes in around 30mins.

Change-Id: I9fbe4db4b0be9b21a6658892c6e4735371376a76
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
index 5461d43..456a279 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
@@ -224,7 +224,9 @@
 
       if (nodes != null && properties.isSubNodeReloadRequired()) {
         cachedNodeByTask.clear();
-        nodes.stream().filter(n -> n != null).forEach(n -> cachedNodeByTask.put(n.task.key(), n));
+        nodes.stream()
+            .filter(n -> n != null && !n.isChange())
+            .forEach(n -> cachedNodeByTask.put(n.task.key(), n));
         names.clear();
         nodes = null;
       }