Parallelize user data load in web editor request (#2973)

This commit is contained in:
Luck 2021-04-07 08:32:02 +01:00
parent 327ccec02f
commit 82488140ee
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -255,12 +255,13 @@ public class WebEditorRequest {
stream.filter(uuid -> !users.containsKey(uuid)) stream.filter(uuid -> !users.containsKey(uuid))
.sorted() .sorted()
.limit(MAX_USERS - users.size()) .limit(MAX_USERS - users.size())
.forEach(uuid -> { .map(uuid -> plugin.getStorage().loadUser(uuid, null))
User user = plugin.getStorage().loadUser(uuid, null).join(); .forEach(fut -> {
User user = fut.join();
if (user != null) { if (user != null) {
users.put(uuid, user); users.put(user.getUniqueId(), user);
plugin.getUserManager().getHouseKeeper().cleanup(user.getUniqueId());
} }
plugin.getUserManager().getHouseKeeper().cleanup(uuid);
}); });
} }