Fix MongoDao issue causing unnecessary writes each time a user is loaded (#589)
This commit is contained in:
parent
90cbff885f
commit
2baea0ce13
@ -277,11 +277,12 @@ public class MongoDao extends AbstractDao {
|
|||||||
// User exists, let's load.
|
// User exists, let's load.
|
||||||
Document d = cursor.next();
|
Document d = cursor.next();
|
||||||
|
|
||||||
|
String name = d.getString("name");
|
||||||
user.getPrimaryGroup().setStoredValue(d.getString("primaryGroup"));
|
user.getPrimaryGroup().setStoredValue(d.getString("primaryGroup"));
|
||||||
user.setName(d.getString("name"), true);
|
|
||||||
|
|
||||||
Set<Node> nodes = nodesFromDoc(d).stream().map(NodeModel::toNode).collect(Collectors.toSet());
|
Set<Node> nodes = nodesFromDoc(d).stream().map(NodeModel::toNode).collect(Collectors.toSet());
|
||||||
user.setEnduringNodes(nodes);
|
user.setEnduringNodes(nodes);
|
||||||
|
user.setName(name, true);
|
||||||
|
|
||||||
boolean save = plugin.getUserManager().giveDefaultIfNeeded(user, false);
|
boolean save = plugin.getUserManager().giveDefaultIfNeeded(user, false);
|
||||||
if (user.getName().isPresent() && (name == null || !user.getName().get().equalsIgnoreCase(name))) {
|
if (user.getName().isPresent() && (name == null || !user.getName().get().equalsIgnoreCase(name))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user