Materialize stream of all groups as late as possible

In most situations, we actually work with a filtered list of all groups.
By staying with streams as long as possible, we can avoid to
materialize an unnecessarily large list. When we switch to NoteDb for
groups, this has the additional benefit that we don't need to read in
all groups from NoteDb at once.

Change-Id: Ieaab464e5a2fb727c2defffa6bd7b52d4738721b
This commit is contained in:
Alice Kober-Sotzek
2017-09-22 15:52:35 +02:00
committed by David Pursehouse
parent a1c4658a97
commit 1d8e95f132
4 changed files with 119 additions and 111 deletions

View File

@@ -357,7 +357,8 @@ public abstract class AbstractDaemonTest {
// later on. As test indexes are non-permanent, closing an instance and opening another one
// removes all indexed data.
// As a workaround, we simply reindex all available groups here.
for (AccountGroup group : groups.getAll(db).collect(toList())) {
Iterable<AccountGroup> allGroups = groups.getAll(db)::iterator;
for (AccountGroup group : allGroups) {
groupCache.evict(group.getGroupUUID(), group.getId(), group.getNameKey());
}